#!/bin/bash
#                       /usr/local/bin/services.kali
# https://crystalfaeries.net/posix/bin/services.kali
# celeste:crystalfaery SERVICES.KALI 2017-11-12 19:28:41+00:00
# By default Kali Linux(TM) does not upon boot-up
# launch many services by default, therefore
# in one command we have the ability for root to launch such:
# PORT     STATE SERVICE
# 25/tcp   open  smtp	(smtp)
# 80/tcp   open  http	(http)
# 143/tcp  open  imap	(imap)
# 993/tcp  open  imaps	(imaps)
# 8008/tcp open  http	(Calibre Library) (see user's .crontab)
# 8080/tcp open  http	(XTide Server)

# THIS IS IN TRANSITION FROM SYSVINIT TO SYSTEMD:

# CONFIGURATION:
ADMIN=celeste	# which user is the designated administrator?
STAFF=staff	# which group is allowed administration priveleges?

 for s in			\
	apache2			\
	dictd			\
	dovecot			\
	glances			\
	ntp			\
	postfix			\
	smartmontools		\
	swatd			\

do
	/usr/local/bin/now >>					/var/log/${s}.`hostname`.txt
#	/etc/init.d/${s} restart		|& tee -a	/var/log/${s}.`hostname`.txt
echo "$(systemctl is-enabled	${s}.service): ${s}.service"	\
						|& tee -a	/var/log/${s}.`hostname`.txt
	systemctl restart	${s}.service	|& tee -a	/var/log/${s}.`hostname`.txt
	chown ${ADMIN}:${STAFF}					/var/log/${s}.`hostname`.txt
	chmod 660						/var/log/${s}.`hostname`.txt
	/usr/local/bin/now >>					/var/log/${s}.`hostname`.txt
done


syntax highlighted by Code2HTML, v. 0.9.1