- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Find out cron stated
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-22-2005 09:55 PM
03-22-2005 09:55 PM
Find out cron stated
I must find out whether a shell-script is started by a cron job or by manually by root or an other user.
Thanks
Ralf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 09:58 PM
03-22-2005 09:58 PM
Re: Find out cron stated
/var/adm/cron/log will tell u whom and when a cronjob was fired.
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 10:02 PM
03-22-2005 10:02 PM
Re: Find out cron stated
I mean to find it out in the script file to do different actions.
Ralf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 10:02 PM
03-22-2005 10:02 PM
Re: Find out cron stated
Also check cron log /var/adm/cron/log
sks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 10:20 PM
03-22-2005 10:20 PM
Re: Find out cron stated
goto the directory where all the crontabs are held and search for your shellscript:
cd /var/spool/cron/crontabs
grep shell-scriptname *
Is the script being executed on a regular basis? If yes then its most likely cron or 'at'.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2005 11:44 PM
03-22-2005 11:44 PM
Re: Find out cron stated
perhaps you can make use of the stty command: if you execute "stty -a" in the script and it does not return 0, it must be because no (controlling) terminal is attached - hence I would argue that the script must have been executed from cron.
Just an idea - perhaps other members have obvious arguments against this.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2005 01:58 AM
03-24-2005 01:58 AM
Re: Find out cron stated
Whenever I write a script that can be run either interactively or from cron, I check the $TERM variable. If it has a value, then the script is being run interactively. If not, it's being run from cron or at. Based on that test, I either echo stuff to the terminal, or echo stuff to a log file.
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2005 02:31 AM
03-24-2005 02:31 AM
Re: Find out cron stated
if [ -t 0 ]
then
echo "I'm connected to a terminal. I must be interactive"
else
echo "No terminal"
fi
Man test for details.