Linked Questions

7 votes
2 answers
4k views

How to automate bash scripts which includes sudo commands? [duplicate]

I added some commands to the bash script and those commands need root permission. So then I added sudo keyword to those commands. As the normal way, I added this script to the crontab file to automate ...
Krishan Shamod's user avatar
1 vote
1 answer
15k views

Running script via crontab on reboot [duplicate]

I am using Ubuntu Server 16.04. Everytime I log in, I need to manually run my script: /home/user/ini.sh. This script calls other scripts that need sudo permissions, so I get the prompt, insert my ...
user1156544's user avatar
0 votes
0 answers
61 views

Cron job as specific user not running [duplicate]

On my Ubuntu box I have a crontab setup for my normal user that has the following: 0 0 * * * sudo mysqldump -u root -h localhost --all-databases | gzip > /home/<user>/mysqlbackups/db_`date +%...
Valien's user avatar
  • 111
0 votes
0 answers
25 views

Sudo options question [duplicate]

I need to run a command that requires sudo to run and I want to run it in crontab -e the command is sudo java -jar WurmMapGen.jar but it asks for a password. I want this to be an automatic ...
jpoblocki77's user avatar
642 votes
8 answers
1.3m views

How do I set up a Cron job?

I want to schedule a task to run on a regular basis and have heard that Cron is the way to do this. How do I add Cron jobs in Ubuntu?
Gabriel Solomon's user avatar
36 votes
2 answers
186k views

Running command at startup on crontab

I wanted to run a command on our linux after its done rebooting, I saw that it can be done using crontab. I wanted to run this command sudo ifdown eth0 && sudo ifup -v eth0 on the crontab ...
Lottie's user avatar
  • 393
4 votes
3 answers
5k views

cronjob can't find script file

I have a script (buphomebasis.sh)that uses rsync to make backups from my home directory. Its content is: sudo rsync -avz /home /media/myname/mybackupdsk It works very well, just by invoking that ...
jfh's user avatar
  • 51
1 vote
1 answer
9k views

How to avoid password request for sudo for crontab scripts?

I need that a new user could execute sudo without any request of password, because this user has in crontab a .sh that uses sudo for some commands. I created a new user on my ubuntu server 16.04 x64 ...
realtebo's user avatar
  • 399
2 votes
3 answers
3k views

run crontab as www-data to create a file with www-data as owner

I want to run a crontab command every 5 mins that executes a py script. The py script inturn generates a log file with midnight rotation within /var/www/logs/.The logs dir has 777 permission. The log ...
ns15's user avatar
  • 121
1 vote
1 answer
4k views

Upstart not running .sh script

The information on the web regarding upstart, init and .conf files is rubbish. A lot of different places show completely different ways of doing things. Anyways, I have a script file /home/karl/....
Karl Morrison's user avatar
0 votes
2 answers
2k views

start openvpn client automatically at certain time?

I have an Ubuntu 14.04 Server with an OpenVPN Server running on it. I would like to have an OpenVPN client from this machine connect to a remote machine in order to save backup files on the remote ...
Florian Splett's user avatar
0 votes
3 answers
725 views

sudo ~/.dropbox-dist/dropboxd not working on cron job

I have used this command directly with the command line and it working fine. sudo ~/.dropbox-dist/dropboxd But when I set it to run each minute with cronjob nothing happens. my crontab file # m h ...
Nasser Ali Karimi's user avatar
0 votes
1 answer
808 views

SSH fails in Crontab after reboot

I am regularly running a shell script through Crontab that uses SSH to connect to a server. If I run that script manually it runs through successfully. Within the same session Crontab will ...
Socrates's user avatar
  • 2,473
0 votes
1 answer
737 views

How can I use cron to restart apache in some conditions

This is the first time I'm using cron. I want to restart the apacher in my server if the amount of available memory goes less than 500 mb. To do so I wrote the following script: ...
zwlayer's user avatar
  • 145
1 vote
1 answer
518 views

Ubuntu 16.04LTS Create Cron Job in cron.daily that will display the contents of auth.log to folder in every users home directory?

Ubuntu 16.04 LTS user Hi guys, I am a newb here and I have been searching these forums and google to no avail. My searches have not found the specific info that I need. This is personal project of ...
Final Luminary's user avatar

15 30 50 per page