Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 11-06-2003, 06:19 AM   #1
Registered: Aug 2002
Location: Faroe Islands
Distribution: Knoppix on hd
Posts: 54

Rep: Reputation: 15
Running a script in background on a remote machine

Hi everyone

I have had some troubles with windows machines not being able to see how much space is left on the samba shares.

I have made this little script, which makes a text file containing the space free on the drives.

while true; do
df -H > "/mnt/hdd/freespace.txt";
sleep 10s;

I login via ssh and start the script: ./diskfree &

The script works fine, but when i log out from ssh, the terminal just hangs. And after a while the diskfree program also stops (checked via another ssh connection).

Is there some other way I should run this script on the server?
Old 11-06-2003, 07:25 AM   #2
Registered: Apr 2003
Location: Russia, Khotkovo
Distribution: Debian
Posts: 146

Rep: Reputation: 15
Try nohup command.

nohup you_script
Old 11-06-2003, 08:44 AM   #3
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
man screen

screen ./diskfree

To detach from current session you would hit ctrl+a then ctrl+d. Now you can logout of your current ssh session (Yes, you
should be using ssh to connect to a remote server, NOT TELNET!!!)
To re-claim the screen sessoin you would ssh back into your server then hit screen -r
Old 11-06-2003, 11:08 AM   #4
Registered: Aug 2002
Location: Faroe Islands
Distribution: Knoppix on hd
Posts: 54

Original Poster
Rep: Reputation: 15
Talking Thank you for your answers

I tried to search for the nohup on google, and I found this command which works

nohup ./ < /dev/null > somefile 2>&1 &

The server runs a small version of debian, which is just a few MB, so it doesn't have th screen. Maybe it would be an idea to download it and try it too


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
running X applications on remote machine when logged in via ssh servnov Linux - General 1 08-15-2005 09:53 PM
running graphical program on remote machine abd_bela Debian 1 03-17-2005 08:07 AM
script to monitor process on remote machine kencha Linux - Newbie 6 01-07-2005 01:07 PM
telneting remote machine from a shell script sanjith11 Programming 11 05-26-2004 07:50 AM
Running script in background skguha Linux - Newbie 7 04-02-2004 09:32 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration