-
Exit codes may be as follows (see
status.sh
, others will be updated):- 0: success
- 1: detected error which is not our fault (e.g. network / HW etc): user can try again
- 2: error due to wrong usage of scripts / in config files or some assumption was violated.
- other positive values: something unexpected has happened.
-
One may need to capture both
STDOUT
andSTDERR
. Error messages (inSTDERR
) that are meant to be presented to users (admins) must be as informative as possible.
list_stations.sh
: reads current config cache (STATIONS/
)start_station.sh
: start stopped stationstart.sh $station_id
: initiates station power-on (e.g. via WOL)deploy.sh $station_id
: transfer neccessary configs/scripts if update is necessary (station may have nothing yet)prepare.sh $station_id
: post-action upon changes due to above deploymentdefault_update.sh $station_id
: default framework start on the station (all BG services and GUI application) + updates server's copy of station'slastapp.cfg
appchange_station.sh
: switch GUI applicaiton running on the stationtopswitch_update.sh $station_id $app_id
: switches GUI app. on the station + updates server's copy of station'slastapp.cfg
stop_station.sh
: stop stationfinishall.sh $station_id
: gracefully finish (stop / kill / remove) all running framework' servicesshutdown.sh $station_id -h now
: initiate system shutdown (with power-off) of the station (alternative:poweroff.sh $station_id
)
NOTE: rebooting the station can be done with: shutdown.sh STATION -r now
or reboot.sh STATION
TODOs:
sync.sh
(to synchronize local cacheSTATIONS/
with station configs & scripts from CMS). Sync. is to be performed once before front-end starts & upon request from CMS (external trigger!):list_stations.sh
should also provide descriptionsstart.sh
may not wait for remote machine to power-on completely - there should be a wait on OMD afterwardslastapp.cfg
will be updated during start and appchange in order to indicate the current GUI app - cheaper alternative to waiting for OMD to report that.
-
these scripts are to be directly accessible by high-level action scripts (described above) only.
-
they all currently require server's config cache (
./STATIONS/
) to be alongside with them. -
All server-side management scripts (save for
forall.sh
helper) take non-emptySTATION_ID
handle as the 1st argument and require proper station configurations folder./STATIONS/STATION_ID/
-
All valid and active station handles are listed in
./STATIONS/list
(leading#
means a commented-out line) -
Arguments coming AFTER the leading
STATION_ID
argument to server-side management scripts will be forwarded AS IS to the corresponding command run on the station. -
start.sh STATION_ID [WAKE_UP_ARGS]
: tries to initiate a powering-on (e.g. via wake-on-lan) for the station specified bySTATION_ID
-
deploy.sh STATION_ID
: deploys the content of config cache (./STATIONS/STATION_ID/)
to the specified station viascp
(or maybe viasync.sh
) -
prepare.sh STATION_ID
: prepares the station for framework execution. To be run once after any changes to station configs or management scripts (e.g. due to deployment/package installation) -
default.sh STATION_ID
: lunch all BG services and the specified (by default or cached choice) GUI app. on the station -
topswitch.sh STATION_ID APP2
: stop/kill the current GUI .app and start APP2 -
finishall.sh STATION_ID
: stop/kill all BG services and the current GUI app on the station
lastapp.sh STATION_ID
: retrieve station'slastapp.cfg
and cache it on the server (in./STATIONS/STATION_ID/
)topswitch_update.sh STATION_ID APP2
: runstopswitch.sh STATION_ID APP2
andlastapp.sh STATION_ID
default_update.sh STATION_ID
: runsdefault.sh STATION_ID
andlastapp.sh STATION_ID
remote.sh STATION_ID CMD ARGS
: runs the command specified byCMD ARGS
on the station viassh
. This is the main working-horse for the rest of management scripts. NOTE: it is assumed that the station's user has password-less permissions to run the commands.remote_cmd.sh
: helper to run station-side scripts with the same name (see./template/*.sh
)docker.sh STATION_ID ARGS
: rundocker ARGS
on the stationlauncher.sh STATION_ID COMPOSE_CMD_WITH_ARGS
: rundocker-compose COMPOSE_CMD_WITH_ARGS
on the remote station within corresponding configuration directory (e.g.~/.config/dockapp/
) with all the deployed configuration files after reading the necessary station configs.
NOTE: remote.sh
, status.sh
and lastapp.sh
use SSH_OPTS
from config. cache (station.cfg
and access.cfg
) to do password-less command execution via ssh
.
remote_sbin.sh
: helper for running corresponding system commands on the station:reboot.sh STATION_ID [ARGS]
(runsudo -n -P /usr/sbin/reboot ARGS
on the station)poweroff.sh STATION_ID [ARGS]
(runsudo -n -P /usr/sbin/poweroff ARGS
on the station)shutdown.sh STATION_ID [ARGS]
(runsudo -n -P /usr/sbin/shutdown ARGS
on the station) NOTE that these system commands require password-less permissions on the target station.
forall.sh SERVER_SIDE_SCRIPT_BASENAME ADDITIONAL_ARGUMENTS_FOR_SCRIPT
: for all valid and activeSTATION_ID
in./STATIONS/list
runs:./SERVER_SIDE_SCRIPT_BASENAME.sh $STATION_ID ADDITIONAL_ARGUMENTS_FOR_SCRIPT
.
TODO:
forall.sh
may be replaced with argument to server-side scripts instead of leading station-id argument.deploy.sh
(and maybelastapp.sh
) should better use rsync (e.g.sync.sh
) instead ofscp
.
NOTE: all of the following start from within station's config. cache (e.g. ~/.config/dockapp/
)
prepare.sh
: prepares the station for framework execution. To be run once after any changes to station configs or management scripts (e.g. due to deployment/package installation). May update station'slastapp.cfg
.default.sh
: lunch all BG services and the specified (by default or cached choice) GUI app. on the station. May update station'slastapp.cfg
.topswitch.sh APP2
: stop/kill the current GUI .app and start APP2. May update station'slastapp.cfg
.finishall.sh
: stop/kill all BG services and the current GUI app on the station. May update station'slastapp.cfg
.
launcher.sh COMPOSE_CMD_WITH_ARGS
: rundocker-compose COMPOSE_CMD_WITH_ARGS
within corresponding configuration directory (e.g.~/.config/dockapp/
) with all the config files after reading the necessary ones. This is the basis for higher-level scripts (default.sh
,finishall.sh
,topswitch.sh
andprepare.sh
).ptmx.sh
: misc. helper to try workaround docker setting wrong permissions on system's/dev/pts/ptmx
NOTE: currently lastapp.cfg
is in /tmp/
and exports a single shell env. variable specifying the current GUI app.
NOTE: these files are originally in ./templates/
, for each station will be put into an individual subfolder of ./STATIONS/
, to be deployed into ~/.config/dockapp/
on each station.
station.cfg
: main data fields (as shell variables) about the station. May only be changed manually via CMS.
NOTE: the rest of configs and scripts should be removed from here once the development is finished.
startup.cfg
: determine BG & default FG out of station_type (fromstation.cfg
)access.cfg
: determine system access parameters for the stationcompose.cfg
,docker.cfg
,docker-compose.yml
: determine station local SW configuration (docker, X11, pulseaudio etc) for proper docker-compose functioning.luncher.sh
,finishall.sh
,default.sh
,prepare.sh
,topswitch.sh
: actual action scripts to be deployed to the station.ptmx.sh
: workaround for docker glitch. To be run by prepare.sh
start.sh -> wake-on-lan lastapp.sh -> remote.sh, scp / sync? remote.sh -> ssh status.sh -> remote.sh + ping (+ssh?) start.sh -> [?? remote.sh ??] deploy.sh -> remote.sh, [?? sync.sh / rsync ??] scp lastapp.sh -> status.sh + ssh remote.sh -> ssh lastapp.sh -> ssh sync.sh -> ssh, rsync or lftp
default.sh -> remote_cmd.sh luncher.sh -> remote_cmd.sh prepare.sh -> remote_cmd.sh topswitch.sh -> remote_cmd.sh finishall.sh -> remote_cmd.sh
reboot.sh -> remote_sbin.sh poweroff.sh -> remote_sbin.sh shutdown.sh -> remote_sbin.sh
see the current template in dockapp/mng/templates/station.cfg
-
Generate initial configuration folder:
init.sh station [STATION_TYPE]
- e.g.
init.sh new-station-id simple
(station type/profile:simple
) init.sh new-station-id simple
- e.g.
-
Refresh station configuration in case of template/station-side-scripts changes:
refresh.sh StationID
? -
transfer all the configs to corresponding station:
deploy.sh StationID
+ port-deployment action:prepare.sh StationID
-
start with default services and TOP GUI app.:
default.sh StationID
-
One can now add 'StationID' (by its fixed host-name or IP if static) to OMD (local URL: supernova.mfo.de/default) according to http://blog.unicsolution.com/2014/02/how-to-setup-omd-in-1-hour.html (section: Start Monitoring Target Hosts)