Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How to run a script at background and How to monitor and how to shedule a job using crontab easily ?

 By giving" &" at end of script called running background

                            (OR)

Set in task scheduler or crontjob.

Using at command you can schedule a job to run at a particular date and time. For example, to execute the backup script at 5 a.m tomorrow, do the following.

$ at -f backup.sh 5 am tomorrow

you can run the shell script Following methods at backgroundly:

. script.sh &
./script.sh &
sh script.sh &
       (OR)
nohub sh script.sh &
nohub ./script.sh &
nohub .script.sh &

Note: hup is a hangup signal... nohup - no hangup... so if we give  nohup script.sh & ... it starts progressing script.sh in back ground... that the subsequent logout or session disconnection does not stop..

Note: & Stands for running background

After running this give  "ctrl+z" in background one id will be displayed as running that is called  process_ID using that PID we can adjust priority for that particular jobs.

jobs -l (will display that process id which is running )

Note: jobs will be displayed only the running and stopped jobs for only that session

top -c is also one of option -c means which display the commands. But This will be displayed whole server jobs and services not for session only


if you want commands

screen Sh script.sh

Here are the steps you can follow to run a process in screen, detach from the terminal, and then reattach.

From the command prompt, just run screen. This will give you a new subshell.

Run your desired program

Detatch from the screen session using the key sequence Ctrl-a Ctrl-d (note that all screen key bindings start with Ctrl-a). This will drop you back to your original shell and display a message "[detached]", indicating that the screen session is still running.

You can then list the available screen sessions by running "screen -list"

You can reattach to this screen session by running "screen -r". Once reattached, you will be able to take off where you left off and see any output that was printed to the screen during the time that you were detached. If you have multiple screen sessions, then you can specify the tty name (as displayed by screen -list) as an argument to screen -r to attach to a particular session.

Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

How to Configuration UDEV SCSI Rules In Oracle Linux 5, 6 and 7

aspell

Linux ctime,mtime,atime,cmin,amin,mmin