When a user logs out of his session, the shell is killed. Hence any background processes started in the shell also gets killed. To avoid this and make background processes run even when the user logs out use nohup command.
When nohup (no hangup) command is prefixed with any command, the command continue to run even when the user who run that command logs out.
$ nohup compress comp.dmp &
$
The & indicates that the command runs in the background.
When you log out the session the parent is killed, in such situation the kernel assigns the orphan (child) to the system's init process (PID 1) the parent of all shells. Hence when the user logs out, init takes over the parentage of any process run with nohup.
If you run more than one command in a pipeline, then use the nohup command at the beginning of each command in the pipeline,
$ nohup grep 'ORA-' alert_prod.log & nohup sort &
Thanks
Monday, March 29, 2010
at jobs
Schedule jobs using 'at' command
at command is used to schedule jobs. It takes a series of commands as input and execute it at a particular time in the future. It differs from cron which is used for recurring executions (every hour, every day etc).
at offers the following keywords to be used for scheduling, now, noon, midnight, today and tomorrow. It also accepts the + operator. You can use hours, days, weeks, months and years keywords along with the + operator. For eg,
at 13
at 2.15pm
at midnight
at now + 1 day
at 3:30 January 26, 1986
To schedule job,
$ at 21:29 /export/rmanbkp.sh
$ at 13:15
at> /data_back/expprod.sh
ctrl-d
$
To view the scheduled jobs,
$ at -l
oracle.1266893940.a Mon Feb 22 21:29:00 GMT 2010
oracle.1269888300.a Mon Mar 29 13:15:00 GMT 2010
To remove a job
$ at -r oracle.1269888300.a
Note: There is no way you can find out the name of the program scheduled to run. Only job number is dislayed.
Thanks
at command is used to schedule jobs. It takes a series of commands as input and execute it at a particular time in the future. It differs from cron which is used for recurring executions (every hour, every day etc).
at offers the following keywords to be used for scheduling, now, noon, midnight, today and tomorrow. It also accepts the + operator. You can use hours, days, weeks, months and years keywords along with the + operator. For eg,
at 13
at 2.15pm
at midnight
at now + 1 day
at 3:30 January 26, 1986
To schedule job,
$ at 21:29 /export/rmanbkp.sh
$ at 13:15
at> /data_back/expprod.sh
ctrl-d
$
To view the scheduled jobs,
$ at -l
oracle.1266893940.a Mon Feb 22 21:29:00 GMT 2010
oracle.1269888300.a Mon Mar 29 13:15:00 GMT 2010
To remove a job
$ at -r oracle.1269888300.a
Note: There is no way you can find out the name of the program scheduled to run. Only job number is dislayed.
Thanks
Subscribe to:
Posts (Atom)