- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: shell file doesn't run with crontab
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
10-09-2006 03:35 PM
10-09-2006 03:35 PM
Has anyone faced with this trouble:
I have create a scheduled task in crontab:
00 01 * * * sh /script/perfcheck/checkperf.sh
This shell file will kill and old process and will execute a new process for monitoring system performance.
And the content of that sell file:
########################
ps -ef|grep glance | grep adviser |cut -c9-19 | while read name
do kill -9 $name
done
sh /script/perfcheck/perflog.sh
#########################
The perflog.sh file content:
##########################
GetDate=`date +"%Y%m%d"`
LOG_NM=/script/perfcheck/logfile/log.$GetDate
nohup glance -j 60 -adviser_only -syntax /script/perfcheck/advfile >>$LOG_NM &
##########################
The advfile file:
##########################
print GBL_STATTIME, GBL_CPU_TOTAL_UTIL, GBL_DISK_UTIL_PEAK, GBL_MEM_UTIL, GBL_SWAP_SPACE_UTIL, GBL_DISK_SUBSYSTEM_QUEUE
##########################
The strange thing is:
It killed successful the old process but it doesn't run new process. That means the command:
sh /script/perfcheck/perflog.sh doens't run but the logfile still created (it just create the logfile only!)
Thanks in advanced!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2006 05:21 PM
10-09-2006 05:21 PM
Re: shell file doesn't run with crontab
/opt/perf/bin/glance
OR add PATH variable in the script at the beginning to include the path.
Isnt any error reflected in the mail that you get for cron jobs ?
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2006 06:17 PM
10-09-2006 06:17 PM
Re: shell file doesn't run with crontab
check that your script /script/perfcheck/checkperf.sh has registered both start and end in /var/adm/cron/log; it may not have finished.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2006 06:33 PM
10-09-2006 06:33 PM
Re: shell file doesn't run with crontab
00 01 * * * sh -x /script/perfcheck/checkperf.sh > /tmp/hcc1.debug
########################
ps -ef|grep glance | grep adviser |cut -c9-19 | while read name
do kill -9 $name
done
sh -x /script/perfcheck/perflog.sh > /tmp/hcc2.debug
#########################
It will record cronjob execution step by step into hcc1.debug and hcc2.debug. After you fix your problem, you can remove "-x" option.
Yang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2006 07:12 PM
10-09-2006 07:12 PM
SolutionThe default log is nohup.out unless you
specify an alternative log, which in your
case is done.
However, I would prefer to spawn the perflog.sh as an executable script, and
put the shell inside the script:
Thus
/script/perfcheck/perflog.sh
(chmod u+x perflog.sh)
shell identifier (must be on the first line and fields !!)
#!/sbin/sh
#set -x
GetDate=`date +"%Y%m%d"`
LOG_NM=/script/perfcheck/logfile/log.$GetDate
nohup /path/glance -j 60 -adviser_only -syntax /script/perfcheck/advfile >>$LOG_NM &
print "background PID = $! "
NB:Also use a qualified path name for glance
(but this was already mentioned)
And check if the background process has in
fact started but is not doing what you expected. In that case all works well and
the log will stay empty. It is normal behaviour. You then need to concentrate on the glance command. Try and run it manually first like this:
#nohup /path/glance -j 60 -adviser_only -syntax /script/perfcheck/advfile >>$LOG_NM &
print "background PID = $! "
If that works then we need to look further.
Otherwise trace by putting
set -x or set -xv in the perflog.sh on the second line to see what is going on.
Good luck.