Last active
December 19, 2015 19:29
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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