- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to configure cron
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
Discussions
Discussions
Forums
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
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
тАО02-21-2011 10:12 AM
тАО02-21-2011 10:12 AM
Re: how to configure cron
I changed my script value
$vi rename.sh
mv my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
checked script by running manually and it renamed my file. Then changed running time of cron task
$crontab -e
50 22 * * * /u02/script/rename.sh
it had to run my script at 22:50 but didnt :(
I noticed 1 line messages in log file about rename file:
> CMD: /u02/dump/rename.sh
there are some information which generates every 15 minutes during whole day last half year. dont know what is it. Dont you know what is it? Maybe this makes some barer?
> CMD: /opt/sfm/bin/restart_sfm.sh
> root 12270 c Mon Feb 21 22:05:00 WST 2011
> CMD: /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh
> root 12271 c Mon Feb 21 22:05:00 WST 2011
< root 12270 c Mon Feb 21 22:05:01 WST 2011
< root 12271 c Mon Feb 21 22:05:01 WST 2011
> CMD: /opt/sfm/bin/restart_sfm.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2011 10:15 AM
тАО02-21-2011 10:15 AM
Re: how to configure cron
I changed my script value
$vi rename.sh
mv my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
checked script by running manually and it renamed my file. Then changed running time of cron task
$crontab -e
50 22 * * * /u02/script/rename.sh
it had to run my script at 22:50 but didnt :(
I noticed 1 line messages in log file about rename file:
> CMD: /u02/dump/rename.sh
there are some information which generates every 15 minutes during whole day last half year. dont know what is it. Dont you know what is it? Maybe this makes some barer?
> CMD: /opt/sfm/bin/restart_sfm.sh
> root 12270 c Mon Feb 21 22:05:00 WST 2011
> CMD: /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh
> root 12271 c Mon Feb 21 22:05:00 WST 2011
< root 12270 c Mon Feb 21 22:05:01 WST 2011
< root 12271 c Mon Feb 21 22:05:01 WST 2011
> CMD: /opt/sfm/bin/restart_sfm.sh
regards,
rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2011 11:22 AM
тАО02-21-2011 11:22 AM
Re: how to configure cron
(On Unix systems you edit/view files, not open.)
>But my script did not run.
Add "set -x" to your script to trace execution.
>If script has problem logfile must have error information.
No, the stdout/stderr gets mailed to that user.
>My script includes this line
mv my_file.log my_file_$(date +%m%d%Y).log
That should work fine. You may have problems trying to do this more than once a day.
Also your script should start with:
#!/usr/bin/sh
>All users have privileges:
$ ls -l /u02/scripts/rename.sh
-rwxrwxrwx root sys /u02/scripts/rename.sh
This is a security hole. You shouldn't allow write access:
chmod go-w /u02/scripts/rename.sh
>Do you know what is it?
/opt/sfm/bin/restart_sfm.sh
These are part of System Fault Management. Leave it alone.
>Jose: As we have indicate you should include the full path for used commands
In this case mv and date are in the the default PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2011 12:28 PM
тАО02-21-2011 12:28 PM
Re: how to configure cron
Please ensure that you are inside of a "my_user" session, and at the system prompt executes the command with this trace option: sh -x /u02/script/rename.sh
What happened?
Now try to generate a cumulative trace file at the "crontab -e" session, then replace your current entry by:
50 22 * * * sh -x /u02/script/rename.sh|tee -a /tmp/rename.log
After run it please check te content of /tmp/rename.log file.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2011 12:37 PM
тАО02-21-2011 12:37 PM
Re: how to configure cron
Please ensure that actions above indicated always been done from a "my_user" session.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-21-2011 12:38 PM
тАО02-21-2011 12:38 PM
Re: how to configure cron
50 22 * * * sh -x /u02/script/rename.sh | tee -a /tmp/rename.log
No need to use tee. And you need to capture stderr:
50 22 * * * sh -x /u02/script/rename.sh >> /tmp/rename.log 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 12:54 AM
тАО02-22-2011 12:54 AM
Re: how to configure cron
I add trace in crontab file
crontab -l
11 11 * * * sh -x/u02/scripts/rename.sh >> /tmp/rename.log 2>&1
script has this line:
mv my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
I got rename.log file in /tmp directory.
The file includes this message:
-x/u02/scripts/rename.sh: A specified flag is not valid for this command.
So what is wrong? I guess something wrong in my rename.sh.
Regards,
rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 01:10 AM
тАО02-22-2011 01:10 AM
Re: how to configure cron
did you try it this way ;
/usr/bin/mv my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 01:20 AM
тАО02-22-2011 01:20 AM
Re: how to configure cron
>>did you try it this way ;
>>/usr/bin/mv my_file.log my_file_$(/usr/bin/>>date +%m%d%Y).log
I tried and still have message in my /tmp/rename.log file
-x/u02/scripts/rename.sh: A specified flag is not valid for this command.
All syntaxes work correctly manually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 01:31 AM
тАО02-22-2011 01:31 AM
Re: how to configure cron
11 11 * * * /usr/bin/sh -x/u02/scripts/rename.sh >> /tmp/rename.log 2>&1
try 2:
chmod 755 /u02/scripts/rename.sh
11 11 * * * /u02/scripts/rename.sh >> /tmp/rename.log 2>&1