![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pwd & cd commands not working in shell script | perk_bud | Shell Programming and Scripting | 9 | 04-07-2008 08:11 AM |
| how to sql commands in shell script | balireddy_77 | Shell Programming and Scripting | 1 | 11-15-2006 02:00 PM |
| how can I write script that lets me run shell commands? | umen | Shell Programming and Scripting | 3 | 03-21-2006 08:33 AM |
| How to run unix commands in a new shell inside a shell script? | hkapil | Shell Programming and Scripting | 2 | 01-04-2006 06:56 AM |
| how to execute shell commands in awk script? | RishiPahuja | Shell Programming and Scripting | 1 | 09-02-2005 10:37 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
shell script to run a few commands help!
Hi friends this is first post i am very new to shell scripting so i require your expertise to do the following thank u
I need to write a shell script which will run the following commands pg_dump bank > backup(Enter) Wait for bash prompt to appear coz it indicates that the command is executed dropdb bank(Enter) Wait for bash prompt to appear coz it indicates that the command is executed createdb bank(Enter) Wait for bash prompt to appear coz it indicates that the command is executed psql bank < backup(Enter) Wait for bash prompt to appear coz it indicates that the command is executed I need to run it as a cron demon plz also let me know how to put this as a cron so that it executes every time system starts Thanks in advance |
|
||||
|
U can Put all those in a file and give it Execute Permission
"Wait for bash prompt to appear coz it indicates that the command is executed" Only when a commond get executed it goes to the next command And of Corntab u can add an entry this way @reboot run_script where run_script is ur script... |
|
||||
|
Quote:
u can run all those on promt right?? u can do this File run_script---- #! /bin/ksh pg_dump bank > /input_path/backup dropdb bank createdb bank psql bank < /input_path/backup $chmod u+x run_script $crontab -e It Opens a file in that at the end give the following entry @reboot /full_path_where_ur run_script_is_saved/run_script |
|
||||
|
"input_path" means where u want to take the backup right ?
Aneways thanx a bunch budy i'll try it out and let u know. 1 more thing i wanted to know about cron do i have to put my file in the cron.hourly or cron.daily folder or just crontab -e and do what u said and how do send myself an email from cron - the tasks the script has performed. |
![]() |
| Bookmarks |
| Tags |
| linux, sendmail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|