Skip to content
Permalink
Browse files

Add path to systemctl

  • Loading branch information...
Cat5TV committed Aug 19, 2019
1 parent 144bdef commit f1e53af239ad30e752cbd8d5b22da4f32343fe2b
@@ -21,4 +21,4 @@ fi

chmod +x /etc/rc.local

systemctl enable rc-local
/bin/systemctl enable rc-local
@@ -14,25 +14,25 @@ fi
if [[ -d /etc/systemd/system/getty@tty1.service.d ]]; then
rm -rf /etc/systemd/system/getty@tty1.service.d
fi
systemctl disable getty@tty1.service
systemctl stop getty@tty1.service
/bin/systemctl disable getty@tty1.service
/bin/systemctl stop getty@tty1.service

# Use TTY7
if [[ ! -d /etc/systemd/system/getty@tty7.service.d ]]; then
mkdir /etc/systemd/system/getty@tty7.service.d
fi
systemctl disable getty@tty7.service
systemctl stop getty@tty7.service
/bin/systemctl disable getty@tty7.service
/bin/systemctl stop getty@tty7.service
echo "
[Service]
ExecStart=
ExecStart=-/usr/local/share/nems/nems-scripts/bootscreen.sh
StandardInput=tty
StandardOutput=tty
" > /etc/systemd/system/getty@tty7.service.d/override.conf
systemctl daemon-reload
systemctl enable getty@tty7.service
systemctl start getty@tty7.service
/bin/systemctl daemon-reload
/bin/systemctl enable getty@tty7.service
/bin/systemctl start getty@tty7.service
chvt 7

if [[ ! -f /etc/rc.local ]]; then
@@ -2,4 +2,4 @@
echo $0 > /var/www/html/userfiles/nems-build.cur

echo "Reloading Daemon"
systemctl daemon-reload
/bin/systemctl daemon-reload
@@ -10,10 +10,10 @@ platform=$(/usr/local/share/nems/nems-scripts/info.sh platform) # This is why w
apt -y install firewalld

# Stop it if started so we can load new services
systemctl stop firewalld
/bin/systemctl stop firewalld

# Unmask the service
systemctl unmask firewalld
/bin/systemctl unmask firewalld

# Setup firewall rules
if [[ -d /usr/lib/firewalld/services ]]; then
@@ -23,8 +23,8 @@ platform=$(/usr/local/share/nems/nems-scripts/info.sh platform) # This is why w
fi

# Start the firewall
systemctl enable firewalld
systemctl start firewalld
/bin/systemctl enable firewalld
/bin/systemctl start firewalld

# Set the default zone to public
firewall-cmd --set-default-zone=public
@@ -50,4 +50,4 @@ platform=$(/usr/local/share/nems/nems-scripts/info.sh platform) # This is why w
fi

# Reload the current services
systemctl reload firewalld
/bin/systemctl reload firewalld
@@ -15,7 +15,7 @@ apt -y install ssl-cert libapache2-mod-security2
# Generating new Snakeoil cert
/usr/sbin/make-ssl-cert generate-default-snakeoil --force-overwrite

systemctl stop apache2
/bin/systemctl stop apache2
cp -f /root/nems/nems-migrator/data/1.5/apache2/sites-available/nems-dashboard.conf /etc/apache2/sites-available

a2dissite 000-default
@@ -29,5 +29,5 @@ a2enconf security
/bin/sed -i~ '/SecServerSignature/d' /etc/apache2/conf-available/security.conf
echo "SecServerSignature NEMS_Linux/$ver" >> /etc/apache2/conf-available/security.conf

systemctl start apache2
/bin/systemctl start apache2

@@ -55,4 +55,4 @@ apt install -y $repo php7.3-sybase

echo "Done."

systemctl restart apache2
/bin/systemctl restart apache2
@@ -37,7 +37,7 @@ fi
make install-commandmode
make install-webconf

systemctl stop nagios
/bin/systemctl stop nagios
cp -f /root/nems/nems-migrator/data/1.5/nagios/etc/nagios.cfg /usr/local/nagios/etc/

# Restore nems-www theme
@@ -48,7 +48,7 @@ if [[ ! -e /usr/local/nagios/share ]]; then
ln -s /var/www/html/share/nagios /usr/local/nagios/share
fi

systemctl start nagios
/bin/systemctl start nagios

# Finished installing Nagios Core

@@ -66,7 +66,7 @@ if [[ ! -e /var/lib/nagios/ ]]; then
fi

# Reload daemon units in case Nagios was running while updated
systemctl daemon-reload
/bin/systemctl daemon-reload

if [[ ! -d /usr/local/nagios/var/rw ]]; then
echo "Something went wrong. The rw folder doesn't exist even after script completion."
@@ -5,7 +5,7 @@ nrpeVer="3.2.1"

APT_LISTCHANGES_FRONTEND=cat
echo $0 > /var/www/html/userfiles/nems-build.cur
systemctl stop nrpe
/bin/systemctl stop nrpe
yes | apt remove --purge nagios-nrpe-plugin
yes | apt remove --purge nagios-nrpe-server
yes | apt autoremove
@@ -33,7 +33,7 @@ make install-daemon
make install-config
make install-init

systemctl stop nrpe
/bin/systemctl stop nrpe

wget -O /usr/local/nagios/etc/nrpe.cfg https://raw.githubusercontent.com/Cat5TV/nems-migrator/master/data/1.5/nagios/misc/nrpe.cfg

@@ -43,9 +43,9 @@ wget -O /usr/local/nagios/etc/nrpe.cfg https://raw.githubusercontent.com/Cat5TV/
wget -O /usr/lib/nagios/plugins/custom_check_mem https://raw.githubusercontent.com/Cat5TV/nems-migrator/master/data/1.5/nagios/plugins/custom_check_mem
chmod +x /usr/lib/nagios/plugins/custom_check_mem

systemctl start nrpe
systemctl enable nrpe
systemctl status nrpe --no-pager
/bin/systemctl start nrpe
/bin/systemctl enable nrpe
/bin/systemctl status nrpe --no-pager

# so error code on failure doesn't fail run-parts
echo "Done."
@@ -38,10 +38,10 @@ if ! grep -q "www-data ALL=NOPASSWD: /bin/systemctl restart nagios" /etc/sudoers
fi

# Change some permissions changes
systemctl stop apache2
/bin/systemctl stop apache2
dpkg-statoverride --update --add nagios www-data 2710 /usr/local/nagios/var/rw
cp -f /root/nems/nems-migrator/data/1.4/apache2/conf-available/nagios.conf /etc/apache2/conf-available/
systemctl start apache2
/bin/systemctl start apache2

# Setup log for sendemail
if [[ ! -f /var/log/sendemail.log ]]; then
@@ -5,8 +5,8 @@ echo $0 > /var/www/html/userfiles/nems-build.cur
a2enmod cgi
a2enconf nagios

systemctl enable nagios
systemctl stop nagios
/bin/systemctl enable nagios
/bin/systemctl stop nagios

# nagios cannot be running yet since we have to install the socket first
# See 055
@@ -71,7 +71,7 @@ cd ..
touch /var/log/nagios/livestatus.log
chown nagios:nagios /var/log/nagios/livestatus.log

systemctl start nagios
/bin/systemctl start nagios

printf "Waiting for socket to open..."
while [ ! -S /usr/local/nagios/var/rw/live.sock ]
@@ -1,7 +1,7 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

systemctl stop nagios
/bin/systemctl stop nagios

if [[ ! -e /var/lib/nagios/ ]]; then
mkdir /var/lib/nagios/
@@ -12,4 +12,4 @@ fi
# Create precache file for NEMS Mobile UI in /var/lib/nagios
/usr/local/nagios/bin/nagios -pv /usr/local/nagios/etc/nagios.cfg

systemctl start nagios
/bin/systemctl start nagios
@@ -23,4 +23,4 @@ cp -f /root/nems/nems-migrator/data/1.4/nagvis/nagvis.ini.php /etc/nagvis/etc/

# Turn me on!
a2enconf nagvis
systemctl restart apache2
/bin/systemctl restart apache2
@@ -6,7 +6,7 @@ cd /var/www/
apt update
# Need to be able to use the MySQL database from PHP
apt install -y libdbi-perl libdbd-mysql-perl
systemctl restart apache2
/bin/systemctl restart apache2
git clone https://github.com/Cat5TV/nconf && chown -R www-data:www-data nconf
# Import nConf Configuration
cp -f /root/nems/nems-migrator/data/1.4/nconf/deployment.ini /var/www/nconf/config/
@@ -53,8 +53,8 @@ fi
nems-cert

# Restart related services
systemctl restart apache2
systemctl restart nagios
/bin/systemctl restart apache2
/bin/systemctl restart nagios


# Install 9590
@@ -56,5 +56,5 @@ cp -f share/graph.gif /usr/local/nagios/share/images/action.gif
# Cleanup backups of CSS files
rm /var/www/html/share/nagios_themes/nems-1.3/nagiosgraph.css.*

systemctl restart nagios
/bin/systemctl restart nagios

@@ -2,9 +2,9 @@
echo $0 > /var/www/html/userfiles/nems-build.cur

# Replace the database with Sample database
systemctl stop mysql
/bin/systemctl stop mysql
rm -rf /var/lib/mysql/
cp -R /root/nems/nems-migrator/data/$(/usr/local/bin/nems-info nemsbranch)/mysql/NEMS-Sample /var/lib
mv /var/lib/NEMS-Sample /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
systemctl start mysql
/bin/systemctl start mysql
@@ -1,11 +1,11 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur
systemctl stop smbd
/bin/systemctl stop smbd
cp /root/nems/nems-migrator/data/1.5/samba/smb.conf /etc/samba/
init=$(/usr/local/bin/nems-info init)
if [[ $init == 1 ]]; then
username=$(/usr/local/bin/nems-info username)
/bin/sed -i -- 's/nemsadmin/'"$username"'/g' /etc/samba/smb.conf
fi
systemctl start smbd
/bin/systemctl start smbd

@@ -14,9 +14,9 @@ if (( $platform < '10' )); then
apt update
apt -y install rpimonitor
/etc/init.d/rpimonitor update
systemctl stop rpimonitor
/bin/systemctl stop rpimonitor
cp /root/nems/nems-migrator/data/1.4/rpimonitor/daemon.conf /etc/rpimonitor/
cp -f /root/nems/nems-migrator/data/1.4/rpimonitor/template/* /etc/rpimonitor/template/
systemctl start rpimonitor
/bin/systemctl start rpimonitor
echo "Done."
fi
@@ -28,10 +28,10 @@ apt install -y libio-socket-ssl-perl
dpkg -i /tmp/monitorix.deb

# Use NEMS config files
systemctl stop monitorix
/bin/systemctl stop monitorix
cp -f /root/nems/nems-migrator/data/1.4/monitorix/monitorix.conf /etc/monitorix/
cp -f /root/nems/nems-migrator/data/1.4/monitorix/raspberrypi.rrd /var/lib/monitorix/

# Make it so
systemctl start monitorix
systemctl enable monitorix
/bin/systemctl start monitorix
/bin/systemctl enable monitorix
@@ -16,12 +16,12 @@ if (( $platform == 21 )); then
else

# dhcpcd5 is a dependency of Raspberry Pi networking, so must remain installed, but will disable
systemctl stop dhcpcd
systemctl disable dhcpcd
/bin/systemctl stop dhcpcd
/bin/systemctl disable dhcpcd

# Disable networking and enable NetworkManager
systemctl enable NetworkManager
systemctl disable networking
/bin/systemctl enable NetworkManager
/bin/systemctl disable networking

# Use NetworkManager to manage interfaces, even if configured within /etc/network/interfaces
if grep -q "managed=false" /etc/NetworkManager/NetworkManager.conf; then
@@ -4,7 +4,7 @@
ver=5.25.3

# stop it if it is already running from a previous apt task
systemctl stop monit.service
/bin/systemctl stop monit.service

echo $0 > /var/www/html/userfiles/nems-build.cur

@@ -45,8 +45,8 @@ if [[ ! -d /var/lib/monit ]]; then
mkdir -m 0750 -p /var/lib/monit
fi

systemctl enable monit.service
systemctl start monit.service
/bin/systemctl enable monit.service
/bin/systemctl start monit.service

# don't error out of run-parts
echo "Done."
@@ -100,5 +100,5 @@ ln -s /opt/okconfig/usr/bin/okconfig /usr/local/bin/
okconfig init
okconfig verify

systemctl restart apache2
/bin/systemctl restart apache2

@@ -51,6 +51,6 @@ quit
done

# Restart NetworkManger to re-establish all connections
systemctl restart network-manager
/bin/systemctl restart network-manager

fi
@@ -31,8 +31,7 @@ RUN wget -O /tmp/systemctl.zip https://github.com/gdraheim/docker-systemctl-repl
make && \
mv ./files/docker/systemctl3.py /usr/local/bin/ && \
chmod +x /usr/local/bin/systemctl3.py && \
ln -s /usr/local/bin/systemctl3.py /bin/systemctl \
ln -s /usr/local/bin/systemctl3.py /usr/bin/systemctl
ln -s /usr/local/bin/systemctl3.py /bin/systemctl

CMD ["/bin/bash", "-c", "/bin/systemctl"]

@@ -53,3 +52,5 @@ EXPOSE 2812/tcp
EXPOSE 9090/tcp

RUN /root/nems/nems-admin/nems-build.sh 21

RUN rm -Rf /tmp/*

0 comments on commit f1e53af

Please sign in to comment.
You can’t perform that action at this time.