add systemd timer
This commit is contained in:
parent
93239f93d5
commit
b0afa59758
|
@ -7,3 +7,6 @@ git clone https://git.stack-source.com/msb/vmail-stack.git
|
|||
cd vmail-stack
|
||||
bash install.sh
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
13
install.sh
13
install.sh
|
@ -15,7 +15,7 @@ if ! grep -q "Ubuntu 20.04" /etc/issue; then
|
|||
fi
|
||||
|
||||
# check if install is already in place
|
||||
if [ -f "/etc/vmail.conf" ] || [ -d "/var/vmail/" ]; then
|
||||
if [ -d "/var/vmail/" ]; then
|
||||
echo "vmail-stack is already installed, bailing out."
|
||||
exit
|
||||
fi
|
||||
|
@ -127,6 +127,17 @@ systemctl restart dovecot
|
|||
chmod 755 bin/*
|
||||
cp bin/* /usr/local/bin/
|
||||
|
||||
# install & enable vmail systemd cron
|
||||
cp sbin/vmail-cron.sh /usr/local/sbin/
|
||||
chmod 755 /usr/local/sbin/vmail-cron.sh
|
||||
cp systemd/vmail-cron.* /usr/lib/systemd/system/
|
||||
chmod 644 /usr/lib/systemd/system/vmail-cron.*
|
||||
systemctl daemon-reload
|
||||
systemctl start vmail-cron.timer
|
||||
|
||||
chmod 755 sbin/*
|
||||
cp sbin/* /usr/local/sbin/
|
||||
|
||||
# download and install roundcubemail
|
||||
# cd /usr/local/src/
|
||||
# wget --continue --quiet https://github.com/roundcube/roundcubemail/releases/download/1.4.11/roundcubemail-1.4.11-complete.tar.gz
|
||||
|
|
4
sbin/vmail-cron.sh
Executable file
4
sbin/vmail-cron.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# purge Junk & Trash of messages older than 30 days for all mailboxes
|
||||
/usr/local/bin/vmail-purge-dirs.sh
|
13
systemd/vmail-cron.service
Normal file
13
systemd/vmail-cron.service
Normal file
|
@ -0,0 +1,13 @@
|
|||
# vmail-stack
|
||||
# https://git.stack-source.com/msb/vmail-stack
|
||||
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
||||
#
|
||||
[Unit]
|
||||
Description=vmail-stack cron
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/sbin/vmail-cron.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
14
systemd/vmail-cron.timer
Normal file
14
systemd/vmail-cron.timer
Normal file
|
@ -0,0 +1,14 @@
|
|||
# vmail-stack
|
||||
# https://git.stack-source.com/msb/vmail-stack
|
||||
# MIT License Copyright (c) 2021 Matthew Saunders Brown
|
||||
#
|
||||
[Unit]
|
||||
Description=vmail-stack cron once per day
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
Unit=vmail-cron.service
|
||||
AccuracySec=6h
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
17
update.sh
17
update.sh
|
@ -25,6 +25,23 @@ for bin_script in "${bin_script_array[@]}"; do
|
|||
fi
|
||||
done
|
||||
|
||||
# update scripts in sbin
|
||||
chmod 755 sbin/*
|
||||
readarray -t s_script_array < <(ls -1 sbin/)
|
||||
for sbin_script in "${sbin_script_array[@]}"; do
|
||||
if [ -f /usr/local/sbin/$sbin_script ]; then
|
||||
if ! diff -q sbin/$sbin_script /usr/local/sbin/$sbin_script ; then
|
||||
echo "Updating /usr/local/sbin/$sbin_script"
|
||||
cp sbin/$sbin_script /usr/local/sbin/$sbin_script
|
||||
echo
|
||||
fi
|
||||
else
|
||||
echo "Adding new script /usr/local/sbin/$sbin_script"
|
||||
cp sbin/$sbin_script /usr/local/sbin/$sbin_script
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
# check etc configs for diffs
|
||||
readarray -t etc_configs_array < <(find etc/ -type f)
|
||||
for etc_config in "${etc_configs_array[@]}"; do
|
||||
|
|
Loading…
Reference in New Issue
Block a user