How to crontab screen with script inside and a "don't run it if it's already running" check?

Jens Jahnke jan0sch at gmx.net
Fri Jun 1 19:41:22 UTC 2012


Hi,

On Fri, 1 Jun 2012 20:55:00 +0200
Dwayne Henderson <its.code.in.here at gmail.com> wrote:

DH> I run this Ruby script 24/7 (records data from this live stream).
DH> It runs inside a screen though, so it's easy to check in on it
DH> every once in a while.
DH> 
DH> But how do I crontab the screen with the script inside it? It has
DH> to be with a "don't run it if it's already running" check.
DH> [...]

maybe you should create a shell alias. I do the following for my irssi
session:

# Start irssi within screen or switch to it if it is already running.
alias irssi='if pgrep -u $USER irssi;then screen -U -x irssi;else screen -S irssi irssi;fi'

Regards,

Jens

-- 
01. Brachet 2012, 21:37
Homepage : http://www.jan0sch.de

It is a sobering thought that when Mozart was
my age, he had been dead for 2 years.
		-- Tom Lehrer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 704 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20120601/5889d498/attachment.pgp


More information about the freebsd-questions mailing list