MPlayer halts when I exit the SSH session in Linux

I want to launch MPlayer via SSH and let it run (I’m a radio fan). For this I SSH to my remote machine (a Cubietruck running LUbuntu) and I issue the following command:

screen mplayer -playlist .path/to/the/playlist

Everything works as expected, but when I exit my SSH session the music stops altogether. After logging back in I cannot find my screen instance anymore (screen -ls says No Sockets Found in /var/run/screen/ )

I’ve used screen with another application (such as rTorrent) and everything worked ok. Is this a specific MPlayer issue?

Update: the reason I use screen and I'm not going the "nohup" way is that I want to re-gain access to the mplayer instance (change the station, change the playlist etc.)


Solution 1:

Here is your command:

screen mplayer -playlist .path/to/the/playlist

Using screen seems like overkill. To run processed continually in the background on a Linux machine while logged out of a terminal session, I recommend using nohup and & like this:

nohup mplayer -playlist .path/to/the/playlist &

nohup stands for “no hang up” meaning you can log out of your terminal session and the command following nohup will continue to run. The & in shell command usage basically means “take the preceding command and run it as a background task”. So if you combine the two you are basically saying, “Run the following command even if I exit the terminal and run it as a background command so my session has access to the terminal again.”