Ajuda para rodar script no boot (autostart)
Estou tentando rodar o rsync para conectar o Onedrive, no boot do Fedora 34 Gnome, com o comando a seguir: sh -c "rclone --vfs-cache-mode writes mount \"one drive\": ~/OneDrive"
Já tentei os 3 métodos abaixo, tanto usando o comando acima, como através de um arquivo de script *.sh , contendo o mesmo. Se alguém puder me dar uma força nisso eu agradeço! Vlw
MÉTODOS TESTADOS SEM SUCESSO
1 Systemd
This method only suitable for system running systemd
We can simply use “systemctl status” to check, if it returns a list of running services then it’s running systemd, otherwise it’s not,
there are many different ways to check too, refer to: How to: Check if the system is using/running systemd
1.1 Create a systemd start up service under “/etc/systemd/system/”
sudo nano /etc/systemd/system/teststart.service
1.2 Populate necessary contents
[Unit]
Description=Execute custom script on boot
After=default.target
[Service]
ExecStart=/etc/customscripts/testjob.sh
[Install]
WantedBy=default.target
1.3 Enable this service
sudo systemctl daemon-reload
sudo systemctl enable teststart.service
1.4 Reboot to test
sudo reboot
2 crontab
Usually crontab jobs are executed periodically by time, we can use “@reboot” to make sure the script will be executed on system
start up/boot
1 Edit the crontab file
Edit crontab
sudo crontab -e
Add following line to the bottom of the file
@reboot /etc/customscripts/testjob.sh
2 Reboot to test
sudo reboot
3 Using /etc/rc/d/rc.local
3.1 Append the script full path to the end of the “/etc/rc.d/rc.local” file
sudo bash -c 'echo "/etc/customscripts/testjob.sh" >> /etc/rc.d/rc.local'
3.2 Reboot to test
sudo reboot
Salas de discussão
- 721 Todas as salas de discussão
- 5 Eventos
- 402 Fedora
- 7 CoreOS
- 137 Spins
- 11 CINNAMON
- 28 GNOME
- 63 KDE
- 10 LXDE
- 4 LXQT
- 13 MATE
- SOAS
- 3 XFCE
- 13 Server
- 84 Workstation
- 33 SilverBlue
- Atomic
- 3 Labs
- ARM®
- 3 Segurança
- 7 Servidores
- 222 Tutoriais
- 6 Críticas e Sugestões
- 16 Novidades e anuncios
- 5 CentOS
- 18 Games
- 31 Hardware
- 8 Linguagens de programação