1

まだ実行されていない場合は、redshift を開始する非常に単純なシェル スクリプトをまとめようとしています。

#!/bin/sh
if ps -ef | grep -v grep | grep redshift-gtk; then
    exit 0
else
    /usr/bin/redshift-gtk &
    exit 0
fi

スクリプトを複数回実行しようとしましたが、確実に機能します。

私はManjaro i3 btwを実行しています。次に、/usr/lib/systemd/system/ にサービスとタイマーを作成してみました。

/usr/lib/systemd/system/redshift.service

[Unit]
Description=Runs redshift

[Service]
Type=simple
ExecStart=/bin/bash /home/velo/reshift.sh

[Install]
WantedBy=multi-user.target

はい、スクリプトの名前は reshift です。

/usr/lib/systemd/system/redshift.timer

[Unit]
Description=Runs redshift at given intervals
Requires=redshift.service

[Timer]
OnCalendar=*-*-* *:45:00
Persistent=true
Unit=redshift.service

[Install]
WantedBy=multi-user.target

タイマーは、それをトリガーするために、関連する分マークが近くにあったものに変更されました。OnCalender を変更するたびに、次のことを行いました。

>systemctl daemon-restart
>systemctl restart redshift.timer
>systemctl status redshift.timer

実行中で有効になっていると言われている場所。問題は、タイマーがマークに達するたびに何も実行されないことです。私が間違っていることは何か分かりますか?

4

1 に答える 1