Skip to content

Instantly share code, notes, and snippets.

@sng2c
Last active December 19, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sng2c/6006178 to your computer and use it in GitHub Desktop.
Save sng2c/6006178 to your computer and use it in GitHub Desktop.
Simple scripts starting/stopping daemons with own screen sessions. Make 'autostart' directory, and put symbolic link dirs having 'start.sh' file in it.
#!/usr/bin/env perl
use strict;
use File::pushd;
my @apps = <autostart/*>; # Make 'autostart' directory, and put symbolic link dirs having 'start.sh' file in it.
foreach my $d (@apps){
my $dir = pushd($d);
$d =~ m@([^/]+)$@;
my $name = $1;
my $res = system("screen -dmS '$name' ./start.sh");
}
sleep(1);
system("screen -list");
#!/usr/bin/env perl
use strict;
my @apps = <autostart/*>;
foreach my $d (@apps){
$d =~ m@([^/]+)$@;
my $name = $1;
system("screen -S '$name' -X quit");
}
system("screen -list");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment