- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron error?
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
12-12-2002 06:31 AM
12-12-2002 06:31 AM
cron error?
I'm trying to add basic command line 'test' to a cronjob entry, but I keep getting a rc=1 in the cron log.
From the command line:
$ [[ -d /home/rap ]] && print here || print "not here" ;echo $?
here
0
$ [[ ! -d /home/rap ]] && print here || print "not here" ;echo $?
not here
0
now added this to cron for test purposes....
* * * * * [[ ! -d /home/rap ]] && print here || print "not here"
cron log result....
CMD: [[ ! -d /kgegt/kgegate ]] && print here || print "not here"
> rap 3941 c Thu Dec 12 13:01:00 GMT 2002
< rap 3941 c Thu Dec 12 13:01:00 GMT 2002 rc=1
I know about the ">/dev/null 2>&1" should be put after the print commands, thats not the issue.
The bottom line is, I want to check for a directory on the commandline,
and if its there, run a script and if its not, exit cleanly without a cron entry error.
Any advice would be much appreicated, thanks.....
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2002 06:37 AM
12-12-2002 06:37 AM
Re: cron error?
It might be possible to do it the way you are trying, but I'd be inclined to put the test inside of the script, and have the script test for the directory and exit if it isn't there.
That way, your crontab is much cleaner, and you can modify and add tests to the script as needed without having to mess with cron.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2002 06:52 AM
12-12-2002 06:52 AM
Re: cron error?
I too would recommend a wrapper script for this. However, I've tested your cron entry on both 10.20 and 11.00 and it works fine.
My 11.00 test system does have the latest cron/at patch applied (PHCO_27141), suggest you check your system.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2002 06:54 AM
12-12-2002 06:54 AM
Re: cron error?
I would have an entry in cron that just does a call to a script.
Here a script that might work for you:
#!/sbin/sh
if ( test -f /home/rap ) then
echo "found it!"
else
echo "did not find it!"
fi
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2002 07:03 AM
12-12-2002 07:03 AM
Re: cron error?
As said it if far neater and more controlable to put this in a script and then call it from cron.
Ensure that within your script that you define all environmental variables that your script may need.
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2002 07:18 AM
12-12-2002 07:18 AM
Re: cron error?
You could put a "sleep 10;" in front of your command. If the rc=1 message still occurs straight away, then it's likely to be your environment, not the commands themselves.
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2002 12:20 AM
12-13-2002 12:20 AM
Re: cron error?
Thanks for the info, the final fix I found, was to check for the file explicitly, i.e.
[[ -f /home/rap/do-it.sh ]] && /home/rap/do-it.sh || :
This checks for the file, if there, exec it, if not do nothing
Thanks for all your useful pointers....
Richard
P.S. Its the first time I've used this system and its great to get really quick responses, which help me fix my problem.