scripts run on 9:30 AM daily
Dear Friends ,
I have to run a script daily at 9:30 am . my script locates in suppose in /test directory . How can I do it ? |
You would do this with cron. As the user you want the script to run as, give the command "crontab -e" and then enter in the following information:
Code:
# Run script at 9:30 daily: |
Just to expand on the answer, note that the cron env is minimal, which means that if you call any programs, inc Linux ones, always specify the full paths to those as well.
If cron has a problem, it should email either the user or root. |
can't run script auto using crontab ?
Dear ,
Thx for ur reply . Actually I have to run the follwoing Export Database Script as OAcle user at every 9:30 A.M. The script is : "#!/bin/bash # Script for interactive import # Inputs are database name, list of owners Date1=`date +%d%b%Y` Date=`date +%d%b%Y`.`date +%I`.`date +%M%p` mkdir -p /backup/DBbackup/bscdb/$Date1 printf " Enter the Database name [ORACLE SID] which has to be exported : " read OraSid export ORACLE_SID=$OraSid exp / file=/backup/DBbackup/bscdb/$Date1/$OraSid.$Date.dmp full=y statistics=none direct=y log=/backup/DBbackup/bscdb/$Date1/$OraSid.$Date.exp.log " I have to add the above script into the "CRONTAB" Like following way : crontab -e //as ORACLE user's crontab # Run script at 9:30 daily: 30 9 * * * /path/to/script //according to ur mail But the problem is , I dont get any output . Just create the Dated folder only , no dump file is created . All of folder permission are correct but script is not working using the CRONTAB . Here I mention that manually the script is working but I want to run this script using crontab . Plz give me suggestion How can I run the following script using CRONTAB ? |
can't run script auto using crontab ?
Dear ,
Thx for ur reply . Actually I have to run the follwoing Export Database Script as OAcle user at every 9:30 A.M. The script is : "#!/bin/bash # Script for interactive import # Inputs are database name, list of owners Date1=`date +%d%b%Y` Date=`date +%d%b%Y`.`date +%I`.`date +%M%p` mkdir -p /backup/DBbackup/bscdb/$Date1 printf " Enter the Database name [ORACLE SID] which has to be exported : " read OraSid export ORACLE_SID=$OraSid exp / file=/backup/DBbackup/bscdb/$Date1/$OraSid.$Date.dmp full=y statistics=none direct=y log=/backup/DBbackup/bscdb/$Date1/$OraSid.$Date.exp.log " I have to add the above script into the "CRONTAB" Like following way : crontab -e //as ORACLE user's crontab # Run script at 9:30 daily: 30 9 * * * /path/to/script //according to ur mail But the problem is , I dont get any output . Just create the Dated folder only , no dump file is created . All of folder permission are correct but script is not working using the CRONTAB . Here I mention that manually the script is working but I want to run this script using crontab . Plz give me suggestion How can I run the following script using CRONTAB ? |
Well your script looks like it depends on user input to actually do anything (the name of the Oracle DB), so it won't work when run autonomously like that.
You would need to hard-code the name of the database into the script, because nobody is going to be able to actually interact with the script when it is running. |
script using crontab : not work
Thx MS3FGX ,
Ok I have to change my script so that user need not to give Database name manually . "#!/bin/bash # Script for interactive import # Inputs are database name, list of owners Date1=`date +%d%b%Y` Date=`date +%d%b%Y`.`date +%I`.`date +%M%p` mkdir -p /backup/DBbackup/bscdb/$Date1 export ORACLE_SID=orcl exp / file=/backup/DBbackup/bscdb/$Date1/orcl.$Date.dmp full=y statistics=none direct=y log=/backup/DBbackup/bscdb/$Date1/orcl.$Date.exp.log " But still problem is not solved . plz give me some advice ... waiting for ur reply ... |
Exactly what problem have you now got?
Have you set it up as a cron job as described above? |
All times are GMT -5. The time now is 12:16 AM. |