- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script running at startup
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 12:21 AM
01-07-2004 12:21 AM
We have a little script that must keep on running. On the commandline this is started with: # nohup dclabel1 &
Placing this in /sbin/init.d it results in a lot of processes (too many for the system).
What's is the right way to start such process? The content of the script dclabel1 is:
while true
do
cat < /labels/dclabel1_printer | lp -ddclabel1 1>/dev/null 2>/dev/null
done
Thanks in advance,
Geert.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 12:27 AM
01-07-2004 12:27 AM
Solutioncatlabels:3:boot:/fullpathtoscript/dclabel1
where you replace "fullpathtoscript" with the appropriate directory structure. The next time you reboot, it will start the script in the background.
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 12:27 AM
01-07-2004 12:27 AM
Re: Script running at startup
In my mind, you could probably be better off using a cron every five minutes or by issuing a wait command after your cat so that your while stops to give time to the cat command to process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 12:31 AM
01-07-2004 12:31 AM
Re: Script running at startup
you definetly need to put a sleep command into the script to stop it going mad or use crontab which is the easiest way :-) John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 01:12 AM
01-07-2004 01:12 AM
Re: Script running at startup
what is /labels/dclabel1_printer ?
Is that a pipe? How do you make sure, you don't try to print half created labels? Otherwise I agree on using crontab. You could let the script running forever with a sleep and check the existence of the process in a crontab job and if necessary restart it.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2004 01:22 AM
01-07-2004 01:22 AM
Re: Script running at startup
while true
do
if [[ -r /labels/dclabel1_printer ]]; do
lp -ddclabel1 /labels/dclabel1_printer 1>/dev/null 2>&1
rm /labels/dclabel1_printer
fi
done
This eliminates the useless use of cat, only prints when there's something to print, and will run indefinitely. I'd also suggest routing the lp output to a log file incase you have errors, but that's just me.
mark