Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 5668  / 1 Year ago, sat, january 28, 2023, 12:14:15

I don't have write permissions to /etc and its sub folders, but even do I would like to have bash script that is executed every morning. How to set it up?



also when i type cron in command line I get




cron: can't open or create /var/run/crond.pid: Permission denied




P.S. This is follow up question to How to append text to file every morning?



P.S.2. Sometimes I don't turn off my computer, so I would rather not use "auto-start"


More From » bash

 Answers
5

Unless you're actively blocked from doing cron jobs (i.e., not on /etc/cron.allow or on /etc/cron.deny), then you should be able to run your own cron jobs.



Run crontab -e to open the cron job editor. If it's your first time you'll be asked to select a command line editor. You should probably choose nano unless you're familiar with one of the other choices.



Cron entries have the format



m h d mon wkday command


So putting in the entry



00 04 * * * bash script.sh


will execute your script at 4:00 am every day.



Save the file and cron will automatically implement it if there are not syntax errors.



See here for more information about cron.


[#42212] Sunday, January 29, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tresein

Total Points: 197
Total Questions: 113
Total Answers: 112

Location: Hungary
Member since Wed, Nov 9, 2022
2 Years ago
tresein questions
Tue, Jun 28, 22, 17:57, 2 Years ago
Sun, Apr 3, 22, 07:11, 2 Years ago
Thu, Feb 3, 22, 18:03, 2 Years ago
Sat, May 13, 23, 13:00, 1 Year ago
;