RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

Starting a process remotely with nohup command

Every process which starts from a terminal is tied to shell as a child process from which it was executed. In the situation when a parent program gets terminated the child process will be terminated also as a result parent process termination.

This is not particularity desired behavior when a user needs to run a process remotely and let the process run after logout. Fir this reason a nohup command exists. nohp ensures that the process is not tied to any particular shell so user can kill shell process by logging out and the process executed with nohup will be kept alive. Syntax for nohup is as follows:

$ nohup my-command > my-command.out &

Note the output file will be created as this will capture any STDOUT coming out from my-command. & returns a shell as it runs my-command on the background. Here is a small example to test this theory:

Run a yes command with nohup and redirect a output to the /dev/null. Make sure that you use & at the end of the command to run the command on the background:

$ nohup yes > /dev/null &
[1] 3594

now close or log out from the terminal, open another session and run a following command:

ps aux | grep yes
lilo 3594 98.3 0.0 3016 504 ? R 11:06 1:23 yes

Note that process PID 3594 is still running. To kill that process run:

kill 3594

Share this linux post:

Submit Starting a process remotely with nohup command in Delicious Submit Starting a process remotely with nohup command in Digg Submit Starting a process remotely with nohup command in FaceBook Submit Starting a process remotely with nohup command in Google Bookmarks Submit Starting a process remotely with nohup command in Stumbleupon Submit Starting a process remotely with nohup command in Technorati Submit Starting a process remotely with nohup command in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download