You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
997 B

{% calculate run='/bin/bash', pkg('sys-process/vixie-cron')!= %}
# Шаблон миграции с vixie-cron на cronie
# Если пользователь не менял основной файл /etc/crontab, то замещает его на
# новый от cronie
# Завершает процесс vixie-cron и запускает службу cronie
origcrontab=/etc/crontab
cfgcrontab1=/etc/._cfg0000_crontab
cfgcrontab2=/etc/._cfg0001_crontab
origmd5sum="b4c104b60b829977a8898a9102cf5a79"
md5sumcrontab_current() {
grep -v -e "^#" -e "^$" /etc/crontab | sed -r 's/ +$//' | md5sum | awk '{ print $1 }'
}
crontab_changed() {
[[ "$(md5sumcrontab_current)" != "$origmd5sum" ]]
}
if [[ -f $cfgcrontab1 ]] && ! [[ -f $cfgcrontab2 ]] && ! crontab_changed
then
mv $cfgcrontab1 $origcrontab
elif crontab_changed
then
echo "Need to update /etc/crontab for correct work of cronie" 1>&2
echo "and reconfigure cronie by command:" 1>&2
echo " cl-core-setup --pkg-name cronie" 1>&2
fi