Create a file:
$ sudo nano /etc/init.d/sendmail-tmpfs
with this content:
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: sendmail-tmpfs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Required-Start:
# Required-Stop:
# Short-Description: Create /var/spool/mqueue and /var/log/mqueue-client on tmpfs at startup
# Description: Create directory structure needed by Sendmail.
### END INIT INFO
#
# main()
#
case "${1:-''}" in
'start')
# create needed directory structure for sendmail
mkdir /var/spool/mqueue
mkdir /var/spool/mqueue-client
chmod 777 /var/spool/mqueue
chmod 777 /var/spool/mqueue-client
;;
'stop')
;;
'restart')
;;
'reload'|'force-reload')
;;
'status')
;;
*)
echo "Usage: $SELF start"
exit 1
;;
esac
#
### BEGIN INIT INFO
# Provides: sendmail-tmpfs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Required-Start:
# Required-Stop:
# Short-Description: Create /var/spool/mqueue and /var/log/mqueue-client on tmpfs at startup
# Description: Create directory structure needed by Sendmail.
### END INIT INFO
#
# main()
#
case "${1:-''}" in
'start')
# create needed directory structure for sendmail
mkdir /var/spool/mqueue
mkdir /var/spool/mqueue-client
chmod 777 /var/spool/mqueue
chmod 777 /var/spool/mqueue-client
;;
'stop')
;;
'restart')
;;
'reload'|'force-reload')
;;
'status')
;;
*)
echo "Usage: $SELF start"
exit 1
;;
esac
Let's make this file executable:
$ sudo chmod 0755 /etc/init.d/sendmail-tmpfs
And set it to start and stop before sendmail service when booting or halting the computer:
$ sudo update-rc.d sendmail-tmpfs defaults 20 20
No comments:
Post a Comment