- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- nohup script hanging on second command
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
04-24-2003 09:31 AM
04-24-2003 09:31 AM
root@whse370 #> cat START.DET_clara
:
set -vx
killfile=/tmp/kill$$
ps -ef |grep '.sh' > $killfile || exit 1
#
if [ `grep archive_accusort_prdctn.sh "${killfile}" | wc -l ` -eq 0 ]
then `su - spkop -c 'nohup /vol51/spkop/data_conversion/archive_accusort_prdctn.sh >> /vol51/apps/production/logs/spk_prdctn.log 2>&1 &'`
echo "SPK PRODSTAT DATA LOAD HAS BEEN STARTED"
else echo "SPK PRODSTAT DATA LOAD IS ALREADY RUNNING"
fi
#echo "next"
if [ `grep archive_gwl_accusort_prdctn.sh "${killfile}" | wc -l ` -eq 0 ]
then `su - gwlop -c 'nohup /vol51/gwlop/data_conversion/archive_gwl_accusort_prdctn.sh >> /vol51/apps/production/logs/gwl_prdctn.log 2>&1 &'`
echo "GWL PRODSTAT DATA LOAD HAS BEEN STARTED"
else echo "GWL PRODSTAT DATA LOAD IS ALREADY RUNNING"
fi
echo "next"
if [ `grep ASI_gwl_accusort_prdctn. "${killfile}" | wc -l ` -eq 0 ]
then `su - gwlop -c 'nohup /vol51/gwlop/data_conversion/ASI_gwl_accusort_prdctn.sh >> /vol51/apps/production/logs/ASI_prdctn.log 2>&1 &'`
echo "GWL ASI PROD DATA LOAD HAS BEEN STARTED"
else echo "GWL ASI PROD DATA LOAD IS ALREADY RUNNING"
fi
rm $killfile
exit 0
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2003 09:40 AM
04-24-2003 09:40 AM
Solutionyou su command shouldn't contain a ' - ' after the su call.
that logs in and creates a new shell for the particular user. as long as the shell runs, the next command will never be run.
just run the su commands as below -
su spkop -c 'nohup /vol51/spkop/data_conversion/archive_accusort_prdctn.sh >> /vol51/apps/production/logs/spk_prdctn.log 2>&1 &'`
However, if you want the users environment settings to come into effect, before the command is run, then the above command would fail.
HTH.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2003 09:50 AM
04-24-2003 09:50 AM
Re: nohup script hanging on second command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2003 09:54 AM
04-24-2003 09:54 AM
Re: nohup script hanging on second command
I'm not sure that you need the backticks around the su command line. You should be able to execute that command from your script without the backticks. Since you aren't using the output of the su command line, it should work fine.
Also, it looks like you are using the contents of the $killfile to see if each of the processes is running. Another way to do that might be like this:
if $(UNIX95=1 ps -fC archive_accusort_prdctn.sh >/dev/null);
then
nohup ....
echo "SPK HAS BEEN STARTED"
else
echo "SPK IS ALREADY RUNNING"
fi
Using the XPG4 part of ps [which is why the UNIX95=1 is used] makes it easier to look for a particular process.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2003 02:35 AM
04-25-2003 02:35 AM
Re: nohup script hanging on second command
I might have been wrong about the shell not exiting part.. that i'd mentioned in my reply.
the comand is run as specified user and then is logged out from.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x638038dfa974d711abdc0090277a778c,00.html
I learnt this today.. sorry for the misinformation.
- ramd.