Hey Ganesh,
This is Mike (sometimes mod of this board -- haven't been around for a while)
You can do what you're looking to do pretty simply, depending on the level of access you have to your system (I'm assuming root or the equivalent so you can reboot.
For parts 1 and 2, create a shell script that calls reboot at the end, like:
- Code: Select all
#!/bin/bash
command1
reboot
then (before you run that script) to handle parts 3 and 4, create a run_once init script. An easy way to do this is to put a an executable script in /etc/rc2.d (or substitute 2 with whatever runlevel you want the script to kick off at), like this:
- Code: Select all
#!/bin/bash
command2
rm $0
reboot
Then just execute script 1 and all 4 parts should happen

If you want to keep the init script, just remove the "rm $0 line" and, if you only want to run it the one time, use something like "file=$0;mv $file ${file}.bak.
Best wishes,
This board has been dry for so long I stopped coming by. I'll keep an eye out for your response if you still need help.
Best wishes,
Mike
ganeshp@moris.org wrote:Hi All,
Is there a way to execute some command and then after the command completes automatically reboot the system and then after the system reboots execute another command ?
For example look at the sequence shown below
(1) Execute command-1
(2) After the command-1 in (1) is completed,reboot the system
(3) Execute command-2
(4) After execution of command-2 reboot the sytem
Is there a way i can automate this process so that i need not reboot the system manually
Thanks and Regards
Ganesh