# systemctl start phpsessionclean.timer
Failed to start phpsessionclean.timer: Unit phpsessionclean.timer is masked.
# cat /lib/systemd/system/phpsessionclean.timer
[Unit]
Description=Clean PHP session files every 30 mins
[Timer]
OnCalendar=*-*-* *:09,39:00
Persistent=true
[Install]
WantedBy=timers.target
# cat /lib/systemd/system/phpsessionclean.service
[Unit]
Description=Clean php session files
[Service]
Type=oneshot
ExecStart=/usr/lib/php/sessionclean
ProtectHome=true
ProtectSystem=true
PrivateTmp=true
# systemctl status phpsessionclean.service
● phpsessionclean.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
# systemctl status phpsessionclean.timer
● phpsessionclean.timer
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
Trigger: n/a
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Wed 2021-01-13 04:15:44 MSK 7h left Tue 2021-01-12 18:41:21 MSK 2h 18min ago certbot.timer certbot.service
Wed 2021-01-13 05:12:16 MSK 8h left Tue 2021-01-12 15:34:11 MSK 5h 25min ago apt-daily.timer apt-daily.service
Wed 2021-01-13 06:14:17 MSK 9h left Tue 2021-01-12 17:37:08 MSK 3h 22min ago motd-news.timer motd-news.service
Wed 2021-01-13 06:54:50 MSK 9h left Tue 2021-01-12 06:22:58 MSK 14h ago apt-daily-upgrade.timer apt-daily-upgrade.service
Wed 2021-01-13 18:00:49 MSK 21h left Tue 2021-01-12 18:00:49 MSK 2h 59min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Mon 2021-01-18 00:00:00 MSK 5 days left Mon 2021-01-11 00:00:06 MSK 1 day 21h ago fstrim.timer fstrim.service
6 timers listed.
Pass --all to see loaded but inactive timers, too.
/etc/cron.d/php
имеется следующая команда для запуска:09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi
/usr/lib/php/sessionclean
запустится, только, если /run/systemd/system
НЕ каталог. А в на моём впс такой каталог существует и скрипт не выполняется никогда.# ls -la /run/systemd/system
total 0
drwxr-xr-x 2 root root 40 ноя 19 17:42 .
drwxr-xr-x 24 root root 540 янв 12 20:20 ..
ll /etc/alternatives/php
lrwxrwxrwx 1 root root 15 апр 12 2020 /etc/alternatives/php -> /usr/bin/php7.4*
ll /usr/bin/php7.4
-rwxr-xr-x 1 root root 4642584 авг 7 17:29 /usr/bin/php7.4*
md5sum /usr/bin/php7.4
2a6d1d654d731bac2abe95ffdb2e39cd /usr/bin/php7.4
# which php
/usr/bin/php
ls -l `which php`
lrwxrwxrwx 1 root root 21 апр 12 2020 /usr/bin/php -> /etc/alternatives/php
На таймер норм
На сервис не норм: