You are not logged in.

#1 2006-08-17 02:43:23

nadman10
Member
From: Erie, PA
Registered: 2005-10-15
Posts: 200

Running scripts

I've got some scripts made that I want to run in the background. However, if I'm SSH'd in, after my session times out, the scripts stop running. How can I make these scripts run until I stop them?

Offline

#2 2006-08-17 02:49:27

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: Running scripts

$ pacman -S screen
$ man screen

run your scripts in the screen and detach screen before logout SSH ( detach-logout keycombo: ctrl-a D D )

Offline

#3 2006-08-17 03:21:51

afu
Member
From: Tuscalooser, Alabummer
Registered: 2004-02-19
Posts: 155

Re: Running scripts

man nohup will tell you what you need.

Or this:
http://www.unet.univie.ac.at/aix/cmds/a … /nohup.htm

Offline

#4 2006-08-17 03:53:56

palandir
Member
Registered: 2006-05-14
Posts: 73

Re: Running scripts

screen is overkill for that (use screen for interactive applications that you need to detach and reattach somewhere else), use nohup instead.
I have a simple bash function for that purpose:

nh() { nohup "$@" &>/dev/null & }

So you just have to run "nh <command>" and it goes in the background, detached from the terminal, without saving the output.

Offline

#5 2006-08-17 12:41:59

nadman10
Member
From: Erie, PA
Registered: 2005-10-15
Posts: 200

Re: Running scripts

Thanks guys

Offline

#6 2006-08-17 14:17:36

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: Running scripts

Hey that nohup sounds really nice way. Never too late to learn new things  big_smile

Offline

Board footer

Powered by FluxBB