- 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-22-2011 02:22 AM
тАО02-22-2011 02:22 AM
Re: how to configure cron
>>try 1:
>>11 11 * * * /usr/bin/sh -x/u02/scripts/>>rename.sh >> /tmp/rename.log 2>&1
it gave nothing new. In log file:
-x/u02/scripts/rename.sh: A specified flag is not valid for this command.
>>try 2:
>>chmod 755 /u02/scripts/rename.sh
>>11 11 * * * /u02/scripts/rename.sh >> /tmp/>>rename.log 2>&1
file didnt rename but in log file new event. Event about privileges
mv: my_file.log: cannot access: No such file or directory
crontab -l
15 15 * * * /u02/scripts/rename.sh >> /tmp/rename.log 2>&1
less rename.sh
/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 02:31 AM
тАО02-22-2011 02:31 AM
Re: how to configure cron
I don't know if I had the same problem, but I've splited it, so you can try this:
#!/usr/bin/sh
DATUM='date +%m%d%Y'
mv my_file.log my_file_$DATUM.log
HTH
V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 02:36 AM
тАО02-22-2011 02:36 AM
Re: how to configure cron
Happens because you have a space omission among "sh -x" and /u02/scripts/rename.sh. Please ensure this one into "crontab -e" session:
11 11 * * * sh -x /u02/scripts/rename.sh >> /tmp/rename.log 2>&1
Would you matter changing the syntax of your script with this one? (the result is the same):
#!/usr/bin/sh
TIMESTAMP=`date +%m%d%Y`
WORKDIR=Please just indicates the full path where the "my_file.log" is placed.
cd $WORKDIR
mv my_file.log my_file_${TIMESTAMP}.log
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 03:05 AM
тАО02-22-2011 03:05 AM
Re: how to configure cron
>/usr/bin/mv my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
are you sure in yur file is on correct place ?
/usr/bin/mv /
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 04:50 AM
тАО02-22-2011 04:50 AM
Re: how to configure cron
Now i have:
$crontab -l
32_17_*_*_*_/usr/bin/sh_-x/u02/scripts/rename.sh_>>_/tmp/rename.log 2>&1
_ means space between words
less rename.sh
/usr/bin/mv /u02/scripts/my_file.log /u03/export/my_file_$(/usr/bin/date +%m%d%Y).log
and checked this command line also:
/usr/bin/mv /u02/scripts/my_file.log my_file_$(/usr/bin/date +%m%d%Y).log
Still all various commands in rename.sh work correct manually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 04:52 AM
тАО02-22-2011 04:52 AM
Re: how to configure cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 05:00 AM
тАО02-22-2011 05:00 AM
Re: how to configure cron
You keep the space omission between "sh -x" and "/u02/scripts/rename.sh".
2_17_*_*_*_/usr/bin/sh_-x_/u02/scripts/rename.sh_>>_/tmp/rename.log_2>&1
_ means space between words.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 05:15 AM
тАО02-22-2011 05:15 AM
Re: how to configure cron
>less rename.sh
>/usr/bin/mv /u02/scripts/my_file.log /u03/export/my_file_$(/usr/bin/date +%m%d%Y).log
You really should start your script with:
#!/usr/bin/sh
Have you tested a dynamic variable for the date?
V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-22-2011 11:01 AM
тАО02-22-2011 11:01 AM
Re: how to configure cron
Right. When you use cron, you start in your home directory. Where are you when you invoke the script manually?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2011 02:21 AM
тАО02-23-2011 02:21 AM
Re: how to configure cron
$crontab -l
35 9 * * * /usr/bin/sh -x /u02/dump/rename.sh >> /tmp/crontasks.log 2>&1
$less rename.sh
/usr/bin/mv /u02/dump/my_file.log /u02/dump/my_file_$(/usr/bin/date +%m%d%Y).log
I wanted to run some other scripts through cron.
I have script which makes dump files of database. I run it manually when we need.
$less exportSID.sh
expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
Then I add task in cron
45 12 * * * /usr/bin/sh -x /u02/dump/exportSID.sh >> /tmp/crontasks.log 2>&1
Got error in /tmp/crontasks.log:
+ expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
/u02/dump/exportSID.sh: expdp: not found.
Then I changed my script
/u01/app/oracle/product/10.2.0/db_1/bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
Got this error:
+ /u01/app/oracle/product/10.2.0/db_1/bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
UDE-00013: Message 13 not found; No message file for product=RDBMS, facility=UDE
UDE-00019: You may need to set ORACLE_HOME to your Oracle software directory
Showed my ORACLE_HOME in export script:
$ORACLE_HOME/bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
Got error:
+ /bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
/u02/dump/exportSID.sh: /bin/expdp: not found.
Tried another method in script:
Showed my ORACLE_HOME in export script
/ORACLE_HOME/bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
Got error:
+ /ORACLE_HOME/bin/expdp system/password@SID FULL=y DUMPFILE=my_file%U.dmp DIRECTORY=my_dir FILESIZE=4G LOGFILE=my_file.log JOB_NAME=FULLexp
/u02/dump/exportSID.sh: /ORACLE_HOME/bin/expdp: not found.
So how I can show expdp in correct syntax?
#whence mv
gave me /usr/bin
but #whence expdp didn├в t give me path.
So I think expdp must be run from ORACLE_HOME/bin
regards,
rustam