cancel
Showing results for 
Search instead for 
Did you mean: 

run schedule batch file

SOLVED
Go to solution
tareq_2
Regular Advisor

run schedule batch file

hi there

i have hp-ux 11i v1 and i want to run batch file in my OS every 1 month and another batch file every week . but i dont know how to do that
any help please

regards
5 REPLIES
Dennis Handly
Acclaimed Contributor

Re: run schedule batch file

From crontab(1):
minute hour monthday month weekday command
00 00 01 * * command # first of month
00 00 * * 0 command # every sunday

Just adjust the MM, HH, MD and WD fields and desired.
Raj D.
Honored Contributor
Solution

Re: run schedule batch file

Tareg,

If you want to run the batch using root privilege:

1. Login to root.
2. Keep a backup using # crontab -l > crontab.orig
3. Use #crontab -e [ To edit crontab ]

4. Add the below entry with the batch script name & path,


00 00 01 * * /home/user/batch1 # 1st of Every Month, midnight.
00 00 * * 1 /home/user/batch2 # Every Sunday midnight.


5. Save with :wq!
6. Veryfy with : # crontab -l
7. Wait for execution on schedule date and check...



________________________________________
FYI:
first 5 entry in cron represents as below:
- minute (0-59),
- hour (0-23),
- day of the month (1-31),
- month of the year (1-12),
- day of the week (0-6 with 0=Sunday).

* more : # man crontab
_________________________________________


Cheers.
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
tareq_2
Regular Advisor

Re: run schedule batch file

thanks for help
but now i face problem in makeing my batch file my batch file is oracle sql command.
what i need
1. login to oracle user
2. run sqlplus
3. run the sql command
how i can collect these steps in batch file and shedule this file.
please find the attached file its contain the sql comman.
any help please.
thanks
Raj D.
Honored Contributor

Re: run schedule batch file

You can run this with su command.
Ex: # su - oracle -c command_file

" If u think u can , If u think u cannot , - You are always Right . "
tareq_2
Regular Advisor

Re: run schedule batch file

thank for help i will do that