- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script that waits for another one to finish...
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
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
03-30-2004 04:08 AM
03-30-2004 04:08 AM
What I am thinking is in a script...
/sbin/init.d/sysedge stop
Here is where I write a command to wait for the next script to finish, under another user,
then...
(how do I do this)
/sbin/init.d/sysedge start
Yes, I tried writing it all in one script, but the middle script needs to run as another user, and when I try to stop the sysedge with that user, but set the sysedge script to chmod u+s, (sticky bit), it looks like it stops it, but it does not.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2004 04:15 AM
03-30-2004 04:15 AM
Re: script that waits for another one to finish...
- flag file (with a timestamp)
- pipe
or ugly one, "ps" look up, status evaluatio, i.e. what is supposed to modify the first script, if it's done, the script has completed.
As for the change of user, if you have superuser provilige, use su :
su - anotherusether -c "command"
good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2004 04:20 AM
03-30-2004 04:20 AM
Re: script that waits for another one to finish...
00 01 * * 1 su admin -c /home/admin/scripts/backup/backup.sh >/dev/null
What I did try was...
00 01 * * 1 /home/scripts/stopsysedge ; su admin -c /home/admin/scripts/backup/backup.sh >/dev/null; /home/scripts/startsysege
The stop sysedge works fine but nothing else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2004 04:20 AM
03-30-2004 04:20 AM
SolutionIn the first script, near the top:
touch $DIR/LOCKFILE
(the rest of your script here)
rm $DIR/LOCKFILE
In the second script, near the top:
while true
do
if test -f $DIR/$LOCKFILE
then
sleep 60
else
break
fi
done
(the rest of your script here)
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2004 04:21 AM
03-30-2004 04:21 AM
Re: script that waits for another one to finish...
The standard method is:
mycmd.sh &
CHILD_PID=${!}
wait ${CHILD_PID} # parent will wait until child finishes
Again, depending upon whether of not this child fork()'s and exec()'s, wait may not do what you want.
Probably the best technique is to have the "stop" process create a file when it is finished and then have the "start" process loop with a sleep until the file appears.
This is a pretty standard technique for synchronizing groups of unrelated processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2004 04:27 AM
03-30-2004 04:27 AM
Re: script that waits for another one to finish...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2005 01:16 AM
02-23-2005 01:16 AM