Tag Info

New answers tagged

0

To run the script like it's running on your own account (with bash) change your crontab to the following: */15 * * * * sudo -u ashish /home/ashish/parser.sh This will run the script almost as if you executed it from the command line on your own account.


3

*/15 * * * * . /home/ashish/parser.sh cron uses sh, not bash, so when you source the script (that's what the . does), it is run under sh, not bash. Remove the .. Also, the PATH for cron is limited. Specify the full paths to commands you use, such as workon, or set PATH yourself.


0

Try this go to. sudo crontab -e then put this line above your cronjob. MAILTO="" save and Exit.


0

Really I don't know why ifdown doesn't work with crontab. Anyway, I faced the same situation a long time ago and have a workaround solution, hope this will help you. Replace ifdown eth1 with /sbin/ifconfig eth1 down 1> /dev/null This worked for me.


1

My recommendation would be to put call the script using standard web path, so you don't mingle the users and permissions, e.g. instead of doing: /usr/bin/php <script> rather do: /usr/bin/wget -q http://localhost/test/cron.php Then you need to make sure the script can be called just from localhost (f.e. using Apache2 access policy). This way the ...


0

Check the output of which php and use the absolute path for php (in my case /usr/bin/php5). */2 * * * * /usr/bin/php /var/www/test/cron.php or just */2 * * * * php /var/www/test/cron.php For clarification, the default $PATH for cron is PATH=/usr/bin:/bin You can check the $PATH with a test entry (Source): * * * * * env > /tmp/env.output ...


0

Try this procedure: create /home/user/logrotate folder mkdir /home/user/logrotate create /home/user/logrotate/my.conf configuration file with logrotate directive as you need create /home/user/logrotate/cronjob to run logrotate every day at 2:30 AM (this is an example) 30 2 * * * /usr/sbin/logrotate -s /home/user/logrotate/status ...


0

Open a terminal and use the following command to know the preferred action that is set, when your system is idle and on ac power. $ gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' you can see in my system it is set to suspend. To change the value to 'hibernate' use the following command in terminal, $ ...


0

Turns out this was the answer: Cron fails at night I'm running this on my server (which I only ssh into) over night. So having an encrypted home drive meant that when I'm not logged in nothing is accessible to anything outside of home, including cron. I moved my script to /usr/local/bin (there may be a better place to put it, but I didn't feel anything ...


0

I think you have created a loop of things. For example consider the following (bad) script, lets call it check.sh: while :; du -sh /home/user >> /some/file 2>/dev/null; sleep 5; done Now create a cron entry so that check.sh will run after every 30 minutes: *\30 * * * * bash /path/to/check.sh Lets consider the script first run at 10:00, the ...


3

One problem is that you're trying to run a graphical application (notify-send) from cron. That takes a little tweaking. You need to set XAUTHORITY and DISPLAY variables in the crontab so that it can connect to your running X session and you need to set XDG_RUNTIME_DIR so it can connect to your pulseaudio session. Unfortunately, these need to be set in the ...


2

As you've probably seen in the comments to your question, the cronjobs in /etc/cron.hourly (and the other, similar directories) are executed by run-parts. run-parts is a little picky about filenames. By default it doesn't execute files whose filenames contain anything other than (all of those from ASCII) uppercase letters lowercase letters digits ...


1

What you need is a mechanism called flushing: forcing a process to write its output, which would otherwise remain buffered until completion. Shell scripts flush on a line by line basis. If you need the output of a shell script before the script is ended, make sure it contains a newline. Python programs can explicitly flush their stdout by calling the flush ...


1

What is the proper file to use and best way to do this? crontab -e is the best way to do it - this will allow you to easy edit per-user crontabs. If I schedule a task as my non-root user, will it run by itself at the time interval as specified, with no issues? Yes, and it will run with the privileges of that user account. As a principle, it is ...


1

Every user has it's own crontab. To see it just type crontab -l and, yes you've seen it right, when you want to add a crontab then simply do crontab -e for the first time you'll be asked about the editor to use with crontab. As you are a newbie as you say, I'd recommend to use nano, it's the simplest editor to use. The crontab itself works like this ...


1

Your commands are not working because /etc/init.d/smbd and /etc/init.d/nmbd have the following at the start: if init_is_upstart; then exit 1 fi So, as the init in ubuntu is now Upstart (/etc/init.d/ is from SysV), you need to run the start-stop scripts from the directory /etc/init/. /etc/init.d/ still exists for ...


0

If running scripts within /etc/cron.* directories, make sure your scripts: are executable, match the Ubuntu/Debian cron script namespace (^[a-zA-Z0-9_-]+$). So for example if you've script with extension (such as .sh) won't work. To print the names of the scripts which would be run on hourly basis, try: sudo run-parts --report --test /etc/cron.hourly


0

You could maybe try enter this paragraph to it: noadm="false" noadm=(v) and to the mysql -v and it might work fine this way.


0

I don't think there will be an option to wake the systems by itself as the os itself is not running. As a matter of fact, before you suspend the system, you can set a waking time or timer, using the internal hardware clock of the system, by using the "rtcwake" command: for example, to wake the computer on tomorrow 8:00: sudo rtcwake -t `date -d ...


3

I increased the number of files limits for everyone this way (segment from /etc/security/limits.conf): # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open files (Doug: - so Samba will not complain) * - nofile 16384 # - rss - max resident set size (KB) # - stack - max stack size (KB) That was on ...


2

Joining commands with && means that the command on the right will only run if the one on the left was successful. This means that your crontab will fail the first time it is run since there is no zip file in /var/www/html/ so the rm /var/www/html/my-zip-file*.zip fails and the mv will not be executed. So, you can either create a file of the right ...


2

I needed the same thing and was looking for solution. Apart from running gpg-agent, which will ask for the password only once (e.g. during boot) and cache it for next usage, I have found nothing. Problem is how to interact with interactive scripts, which are the ones, who ask for user input from stdin. Expect (apt-get install expect) solves exactly that. ...


0

for this wasn't working. another solution i read was to set "LANG=en_US.UTF-8" in the "/etc/environment" file. But wasn't working neither. What was working for me was to open the crontab file with crontab -e and set at the beginning: LANG=de_DE.UTF-8 LANGUAGE=de LC_CTYPE=de_DE.UTF-8 PYTHONIOENCODING=utf8 Which also sets the environment variable. ...



Top 50 recent answers are included