Re: convert crontab jobs to systemd timers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 7 Apr 2022, at 21:22, olivares33561 via users <users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> Sent from ProtonMail, encrypted email based in Switzerland.
> 
> 
> 
> I am getting closer.
> 
> [olivares@fedora user]$ cat poweroff.service
> # /etc/systemd/system/poweroff.service
> [Unit]
> Description = Poweroff machine at 16:20 PM Mo-Fri
> 
> [Service]
> Type=oneshot
> #ExecStart=~/bin/poweroff.sh
> ExecStart=/usr/bin/sudo /usr/bin/systemctl --no-block poweroff.service

To power down the system you can use the command

     /usr/bin/systemctl poweroff

See man systemctl for the details of what this does.

Barry



> [olivares@fedora user]$ cat poweroff.timer
> # /etc/systemd/system/poweroff.timer
> [Unit]
> Description=Poweroff machine at 4:20 PM Mo-Fri
> 
> [Timer]
> OnCalendar=Mon..Fri *-*-* 16:20:00
> Persistent=true
> 
> [Install]
> WantedBy=timers.target
> 
> I get the following error message:
> 
> [olivares@fedora user]$ systemctl --user enable poweroff.service
> The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
> Alias= settings in the [Install] section, and DefaultInstance= for template
> units). This means they are not meant to be enabled using systemctl.
> 
> Possible reasons for having this kind of units are:
> • A unit may be statically enabled by being symlinked from another unit's
>  .wants/ or .requires/ directory.
> • A unit's purpose may be to act as a helper for some other unit which has
>  a requirement dependency on it.
> • A unit may be started when needed via activation (socket, path, timer,
>  D-Bus, udev, scripted systemctl call, ...).
> • In case of template units, the unit is meant to be enabled with some
>  instance name specified.
> [olivares@fedora user]$
> 
> Thank you all for helping me.
> 
> Best Regards,
> 
> 
> Antonio
> _______________________________________________
> users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
> Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux