Menu
  • HOME
  • TAGS

Bash script different ouput when run as cronjob

bash,cron,cron-task

As @Barman said, it works if you change more with cat: Change this line: last_ip=$(more /tmp/last_ip_check.txt) To this: last_ip=$(cat /tmp/last_ip_check.txt) ... and wait for the next execution of the script. I don't know the reason, but as more is a pager, I believe cat is more correct to use in...

Cron Expression for ignoring 1st Saturday of the year & run on all the Saturdays of the year

cron,cron-task,cronexpression

You need put compare in your program, not in cronjob. For example, in Unix shell script: #!/usr/bin/env bash date=$(date +%a) month=$(date +%m) day=$($date +%e) if [ "$date" = "Sat" -a "$month" = "Jan" -a "$day" -lt 8 ];then echo "Doesn't run this script at 1st Saturday of the year." exit...

Celery, AttributeError: 'module' object has no attribute 'celeryconfig'

python,celery,cron-task,celerybeat,periodic-task

The problem was that I should have imported absolute_import from __future__ in celeryconfig.py Doing this solved the problem. from __future__ import absolute_import ...

Run Cronjob (or equivalent) in Rails 4 App for Continuous/repetitve Tasks

ruby-on-rails,ruby,ruby-on-rails-4,cron,cron-task

The gem whenever helps you create cron jobs with Rails.

s3cmd not working as cron-task when echos/dates are added

amazon-web-services,amazon-s3,cron,cron-task,s3cmd

s3cmd uses a configuration file located at ~/.s3cfg. It's probably having trouble picking that up. Pass in --config=/home/username/.s3cfg and see if that helps. In any case, s3cmd isn't consistently maintained. The official commandline client (aws-cli) is much better in many ways. edit: use this as your .sh file, make sure...

Performing a Mass Equation Update on MySQL Tables

php,mysql,cron-task

You probably need to reference the rows of the table in a update onto themselves. Something like: UPDATE your_table SET money = ( ( money + money ) / revenue ) WHERE 1; This will set the rows based on the values in that row itself. This is just an...

setting crontab is not working but crontab -l does via PHP file

php,crontab,cron-task

I'm not sure what exactly you are trying to do, and the way you are trying to change the crontab is not the best way either. Let me show you how I would do it: First, get the user you are when executing the PHP by putting into the PHP...

AWS Lambda Scheduled Tasks

amazon-web-services,cron-task,aws-lambda

During one of the AWS:reInvent sessions on Lambda the speaker noted during Q&A that timed events are on the to-do list and not available yet. For the current time, they recommended using SWF to create a timer, or to create a timer somewhere else. The comment on timed events can...

Rails Fetch record from instagram using cron job

ruby-on-rails,gem,instagram-api,cron-task

We can fetch users media if we have his instagram id and just pass app client_id in request method

How to download attachement to the server using bluehost cron job

php,cron-task,bluehost

Your script doesn't save the file on the server, it only sends it as an attachment to the browser opening the script. You should change fpassthru to file_put_contents() to save the file on the server.

admin crontab won't run sudo command

crontab,root,cron-task

1) Disable requiretty in sudoers file 2) Permit script execution without password: admin ALL=(ALL) NOPASSWD: /home/admin/scripts/monitor.sh 3) I'm not sure but you don't need specify bash after sudo. Just add #! /bin/bash at the begin of the script */5 * * * * sudo /home/admin/scripts/monitor.sh /dev/null 2>&1 ...

wp_schedule_event hook sheduled but not working

php,wordpress,cron,wordpress-plugin,cron-task

Try to move add_action outside of a function: function starthere(){ if (!wp_next_scheduled('my_hourly_event')) { wp_schedule_event( time(), 'hourly', 'my_hourly_event' ); } } add_action( 'my_hourly_event', 'Download_CSV_with_args' ); function Download_CSV_with_args() { wp_mail('[email protected]', 'Automatic email', 'Cron works!'); } ...

Store cron job schedule parameter in an entity

google-app-engine,cron,gae-datastore,cron-task

The only way to change these params is to update the cron.yaml and redeploy the app. To make your life easier though you could enable the push to deploy for your app and edit this file (or any other file) either on GitHub or directly from Google Console....

When does this cron job get executed?

unix,cron,cron-task,cronexpression

Such a picky syntax... 8 10 * * 6 expr `date +\%W` \% 2 == 1 >/dev/null || /path/to/script/scriptToRun.sh First, the cronjob: +---------------- minute (0 - 59) | +------------- hour (0 - 23) | | +---------- day of month (1 - 31) | | | +------- month (1 - 12)...

Showcase website that will reinstall itself every day?

magento,cron,cron-task

There are two good solutions: 1. Virtual Machine Run the entire site in a virtual machine or VPS. Make a snapshot of the machine when it is in the state you want to reset it to. Have a cronjob that triggers the "return to snapshot" routine. The exact details vary...

How to install multiple cron jobs?

linux,shell,crontab,cron-task,cronexpression

Bash positional parameters start from 0 end at 9. And so you have to send all your positional parameters as a single argument. i.e enclose all parameters inside a single-quote or double-quote. Below program will help you. #!/bin/bash files=("/home/admin/Desktop/crontab.sh" "/home/admin/Desktop/crontab1.sh" "/home/admin/Desktop/crontab2.sh" "/home/admin/Desktop/crontab3.sh") args=($(echo $1)) for file in ${files[@]} do list=(${args[@]:0:5})...

Does cron job block the main process or nodejs will create a worker to do cron task

node.js,process,cron,backgroundworker,cron-task

It is supposed to create a worker for you.. It is not well documented in the library docs but: 1) You can see at the dependencies, it depends on node-worker. 2) If the cron job were to be blocking, then the waiting for the cron job to execute (in this...

Trying to get cron.php working in Cpanel for Magento

cron,cpanel,cron-task

After a few tries, this worked for me. * * * * * php /home/sturdi6/public_html/cron.php > /dev/null However the underlying issue I was having (sending confirmation emails) ended up being me needing a SMTP plugin and configuring it to use a webmail address I made in cpanel SMTP Pro Email...

BASH script to copy random directory contents to another location

bash,shell,cron-task

crontab entry (run at midnight) 0 0 * * * /tmp/myscript.bash Here's the contents of /tmp/myscript.bash: #!/bin/bash #Destination directory destDir=/mnt/stuff/someDir #a randomly chosen directory name #Dirs to copy from are named dir0,dir1,dir2,dir3,dir4,dir5,dir6,dir7,dir8,dir9,dir10,dir11 dirName=dir$(($RANDOM%12)) #You can add a case statement to set a different name # based on the number that's...

Run Cron Job On Specific Minute?

cron,crontab,cron-task

That is correct! If you would like to run a job every third minute you could do like this: */3 * * * * ...

How do I run a specific shell script in a cron job?

oracle,csv,cron,crontab,cron-task

Cron jobs run with a very "impoverished" environment. You might need to set up environment variables to locate your tnsnames config files. You're also expecting sqlplus to be on the command path, which it may not be if you haven't set it up in the crontab previously -- I highly...

When a cron job is set to “run every 5 minutes”, does it run every 5 minutes from the moment it's added?

php,cron,cpanel,cron-task

*/5 in the minutes field means "from first to last, every 5 minutes", so it will start running at 0 minutes past the hour and every 5 minutes thereafter.

stop receiving email from cron job and smtp every 15 min

cron,smtp,cron-task

i just append this to my cron command /dev/null 2>&1 sources: http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/...