Nohup

From Wsms

Jump to: navigation, search

Note: This page should be titled nohup (all lowercase). It is Nohup due to technical limitations of Mediawiki.

nohup lets a command run even after the terminal session that started it exits.

Contents

Common Usage

Run a perl script forever.

[root@sdvault ~]$ nohup ntpdate.pl &

Run a perl script forever, sending the output to a specific log file:

[root@sdvault ~]# nohup ./ntpdate.pl 2>&1 > /var/log/ntpdate.pl &

Tips

You can find the process with pstree and kill it with kill.

an aside ntpdate.pl

ntpdate.pl attempts to fix a problem with guest machines running under VMWare. The machine's clock gets way off and ntp (via ntpd) can't keep it in sync. Hence ntpdate.pl:

#!/usr/bin/env perl
use warnings;
use strict;

while (1){
  print `ntpdate 192.168.2.12`;
  sleep 60;
}

questions

see also

Linux_commands

Personal tools