Hello list, Has anyone written a "Software as a Service" script for Linux that runs at "first boot"? I started one for systems that use "SysVinit" (i.e. chkconfig and service commands). I wrote a script for RHEL and SLES that attempts to install Apache at "first boot" of a Linux. It needs to be copied to /etc/init.d and "chkconfig'd on":
#!/bin/bash # # chkconfig: 35 07 92 # Description: Install the Apache Web Server on "first boot" then turn self off # ### BEGIN INIT INFO # Provides: WebServer # Required-Start: cron # Required-Stop: # Default-Start: 3 5 # Default-Stop: # Short-Description: Install the Apache Web server on "first boot" ### END INIT INFO # Above, 'Default-Start' line is used by SuSE, 'chkconfig' is read by RHEL. # if [ "$1" != "start" ]; then # no action other than start run-level return fi cmdCalled=`basename $0` # get the name of the script called if [ -f /etc/redhat-release ]; then # assume this is RHEL echo "$cmdCalled: first boot - installing Apache Web server on RHEL" yum -y install httpd httpd-manual # install Apache with 'yum' elif [ -f /etc/SuSE-release ]; then # assume this is SLES echo "$cmdCalled: first boot - installing Apache Web server on SLES" zypper install apache2-prefork apache2 apache2-doc apache2-example-pages else echo "$cmdCalled: this does not appear to be RHEL nor SLES" fi chkconfig $cmdCalled off As I understand it in RHEL 7 and SLES 12 now use "systemd". It would be nice to have a script that also supports it also. Has anyone already addressed this issue? Any feedback will be appreciated. Thanks. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/
