FAQ Database Discussion Community


Getting output of shell commands in Python (cron)?

python,shell,cron,crontab
I'm trying to write a script which detects my current wifi connection and starts a socks proxy on my local computer. The script itself works fine when I execute it by myself. Since I want everything to be automatically, I was thinking of using crontab. The only problem is that...

Running a python script automatically after mysql starts on raspberry pi boot

python,mysql,linux,raspberry-pi,crontab
I have written a python script that communicates with a mysql database. I made it start automaticalliy on boot by creating a launcher.sh file: #!/bin/sh #launcher.sh cd / cd home/pi/ sudo python ser.py cd / and adding @reboot sh /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1 to the last line of the crontab by:...

two jobs at same line of cron

unix,crontab
How are the executed, if two jobs schedules in same cron line: parallely or sequentially? e.g: 0 3 * * * ./fillers.sh > /dev/null 2>&1; ./pionner.sh > /dev/null 2>&1; ...

Create a cron job with user define dtime

php,linux,amazon-web-services,cron,crontab
I want to create a cron job which will run with the user define time in database. For eg.User can set start time and end time in the database .When the end time is reached I want cron to trigger one script to send mail.First of all Is it possible...

Does crontab script are detected by ps command?

linux,cron,crontab,ps
Hi everyone, I've got a few scripts running with crontab and I know they are actually running thanks to a log file. The thing is, each time I type ps -ef | grep .sh (because my scripts are .sh files) i have no results. I read that crontab was using...

Why does a jcrontab error appear in weblogic whenever I try to load my application?

java-ee,weblogic,crontab
I get an Error 403 forbidden whenever I try to load my app in weblogic. The weblogic console loads fine. In the weblogic log all I see is: <May 7, 2015 4:29:16 PM EDT> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it during the configured idle timeout...

Crontab start node application with forever in production mode

javascript,node.js,crontab,forever
I have a node.js application that I start using forever like so: NODE_ENV=production forever start index.js I've also worked out how to setup crontab to automatically start the forever command for this application on server reboot: @reboot /usr/local/bin/forever start /path/to/my/app/index.js The only problem here is the node environment. How do...

R/Shiny WebApp logs, running in shell (Ubuntu crontab)

r,ubuntu,logging,shiny,crontab
I'm running, using crontab, an R/Shiny WebApp. The crontab expression looks like this: @reboot R -e 'shiny::runApp(...)' | tee /var/log/shiny-server.log I've also tried @reboot R -e 'shiny::runApp(...)' &> /var/log/shiny-server.log but does the same: It prints to the file the header when you initialize R from shell. But it doesn't print...

Using crontab to make a influxdb backup every week

crontab,influxdb
So I'm wondering how can I make a cron job to make influxdb backup every friday at midnigth. In github is an sh file that makes the backup job, here is the link: InfluxDB Backup-Restore Thanks....

Centos Crontab Bad Command

linux,crontab,centos6.5
I have a pretty simple db back-up script that runs perfectly from shell. php /home/db_backup/db_backup.php When I attempt to add a Crontab, I get the vague 'Bad Command errors in crontab, can't install." I've tried w/ php and full path to php. which php returns /usr/bin/php * 1 * *...

chpasswd is unknown command when called in cronjob?

bash,crontab
I am curious about the following: I have a bash script, which is executed once in a month through a cronjob. The following line is giving an error "unknown command" when ran through the cronjob: echo $P | chpasswd When I execute the bash script directly, it is working properly....

Crontab and its logs

crontab,sysadmin
Frist time I am writing crontab. Following is structure of time and Date # * * * * * command to execute # │ │ │ │ │ # │ │ │ │ │ # │ │ │ │ └───── day of week (0 - 6) (0 to 6 are...

Switch to a program on Linux Debian

c#,linux,mono,debian,crontab
I have developed a program in C# using mono toolkit. The program works like a charm on my Linux Debian VPS. I need this program to run constantly and I execute it via a crontab. The process is effectively running in the background. However, I am not able to "show"...

Running a crontab every 15 minutes not working on linux redhat

linux,shell,unix,crontab,redhat
I want to run a crontab every 15minutes. I tried this: 0 */15 * * * ./usr/My_PATH/run.sh But I get this error: 0 command not found Is there something wrong with the syntax ? Many thanks. UPDATE: I corrected the script and I tried this: */15 * * * *...

Scripts works perfect when i run it manually, but on crontab something is wrong

sql,oracle,bash,shell,crontab
I am new on writing Unix shell scripts. I have written a script which include Oracle Database sql codes. As you see below, it writes outout of sql codes on text files and i want to send these outputs by mail. It works very well when i run it manually....

Cronjob for python script not working

python,ubuntu,crontab
I have an ubuntu box I'm trying to setup a cronjob for. When I do crontab -e this is what I am using as the instructions. I need it run every 11 minutes. 0/11 * * * * python /path/to/file/foo.py At the top of the python script I have put:...

sed adding new comment lines in crontab

linux,bash,shell,sed,crontab
I have a script that contains the following line: crontab -l |sed -e 's=\(^.*/usr/local/nextone/bin/setdbrole.sh$\)=#\1=' | crontab - which will add a '#' to a line in the crontab each time it is executed. But everytime that line is executed comment lines are added to the crontab like the below: #...

Emails sent from a cronjob to a local mailbox

email,crontab,sendmail
I have some cronjobs. These cronjobs send emails but I dont want to disable them with (>/dev/null 2>&1). I would like to know how can I deliver these emails to a local mailbox? Server doesnt accept connections from outside. So the port 25 is open only on localhost/127.0.0.1. A solution...

cron job can't source functions from bashrc

crontab
crontab -e: 30 22 * * 7 ~/bin/cron_run.sh ~/bin/cron_run.sh: #!/bin/bash source ~/.bashrc #run_this_function is defined in a script sourced by bashrc run_this_function run_this_function is not found. What is happening here?...

Shell script Permission denied mysqldump: Got errno 32 on write only in Cron

mysql,bash,shell,crontab
I have a simple sh file to backup some MySql databases and FTP them to an external server. The shell script works fine if called from a command line, but doesn't work when scheduled as cron job. All the files are chmdod 777 This is the script mysqldump -uuser-ppassword databasename...

Raspberry Pi script boot order

raspberry-pi,crontab,raspbian,init.d,ppp
There're three forms about running a script on the boot of the Raspberry, that are modifying /etc/rc.local, modifying the cron daemon and making a script that automatically run on boot in /etc/init.d I want to know which of the methods listed about executed first. The point of the question is...

How to schedule an R Script Cronjob in a linux server? [closed]

linux,r,cron,crontab
I am trying to schedule a cronjob to execute an R Script in a linux server. I have achieved to type the commands in the server manually and it works. To do so i have to type the following commands: [email protected]:~# cd /home/script2 [email protected]:/home/script2# Rscript scriptSecos.R How can i specify...

Cron job with CodeIgniter using wget

php,codeigniter,cron,crontab,wget
I am pretty new to setting up cron jobs. What I've done so far is set one up to run every 5 minutes using the following script: */5 * * * * wget -q localhost:8888/example/index.php/controller/function When I run just the wget part from the command line, it works perfectly. But...

Check if output from grep is empty before sending email from Crontab

bash,email,grep,cron,crontab
I have the following entry in my Crontab which will grep my logs for any instance of error, warning, notice etc... 41 17 * * * cd /var/log/crmpicco-logs/; grep -E "error|Warning|Error|Notice|Fatal" $(find . -mtime 0 -type f) 2>&1 | mail -s "Errors/Warnings from Logs" [email protected] What I would like to...

Cron Job, call url with wget

crontab,wget
I have added this command line in my /etc/crontab: */1 * * * * wget http://IP:8080/auctions/updateStatus It doesn't work, what's wrong with it? The link is correct, it's a redirect to a simple java controller....

cron job not running with adding “2>&1”

bash,cron,crontab,stderr
I am setting up a cron job using crontab -e on a machine where I do not have a root privilege. The initial command in crontab is like this: 0 10 * * * /bin/bash /path/myscript.sh >/path/log I found the script did not run, since the system created an empty...

PHP Fatal error: require_once(): Failed opening required

php,ssh,cron,crontab,chmod
I'm just trying to create a file to be run from a cron job but however I'm getting the below error log. PHP Warning: require(../app/src/app.class.php): failed to open stream: No such file or directory in /var/www/mosto.in/manual/gateway.php on line 4 PHP Fatal error: require(): Failed opening required '../app/src/app.class.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/mydomain.in/manual/gateway.php...

How do I install anacron?

linux,virtual-machine,crontab,suse
I'm running on windows with a VM (SLES12). I wanted to automate a script and was using crontab at first, but it doesn't work when my system is off. So I looked into anacron, however I can't seem to find a solution anywhere as to how to install it. Thanks....

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

oracle,csv,cron,crontab,cron-task
I have set up a cron job which will run a shell script to connect to our Oracle database and copy a table as a csv file. crontab -l outputs: */5 * * * * /home/user/import.sh > /home/user/importLog.txt import.sh looks like this: #!/bin/bash FILE="/path/to/application/TABLE.csv" sqlplus -s user/[email protected] <<EOF SET PAGESIZE...

Crontab not working as expected

linux,shell,crontab
#/bin/bash cd /home/oracle/scripts/mon_scripts/ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 export ORACLE_SID=test cat /dev/null > /home/oracle/scripts/mon_scripts/wget_cache.out a=`sqlplus test/[email protected]/home/oracle/scripts/mon_scripts/flushtable.sql|grep -A 2 COUNT|tail -n1` if [ $a == 0 ];then ( echo "Empty- Nothing Processed" ) else ( echo "localhost" >> wget_cache.out ssh localhost wget http://localhost/cs/ContentServer?pagename=debug/ReloadRefData -O - >> wget_cache.out echo "--------------" >>...

Crontab not piping to file (LINUX)

linux,pipe,crontab
The cronjob does not pipe the output from another script to a file but it works I execute it (not same user, chmod for both files is set to 777). #! /bin/sh . /disk2/etc/env_cron SUBJ="Test" TEXT=/disk2/home/user/mailtxt ADDR="[email protected]" echo -e `date` > $TEXT echo -e "1\n\n\nq" | menu >> $TEXT mutt...

Raspbian: Reset Bash environment variables

bash,raspberry-pi,crontab,raspbian
I was trying to get a crontab working on my Raspberry PI and I think I messed up my environment variables. I can execute a file from the GUI by right-clicking and choosing execute. However I cannot get the same file to run from command line. I can use ls...

Crontab will not run?

python,cron,crontab
My cron tab is set up like this: * * * * * /usr/bin/python /root/amazon/hello.py hello.py is #!/usr/bin/python print "yo" I am trying to just run the script and get it working to print to the console yo every minute? What am I doing wrong I included the header to...

out.log file and error.log file size exceed

linux,crontab,logrotate
The following line which include into the cronjob. 18,36,54 * * * * /usr/bin/perl /home/folder.my_perl.pl >> out.log 2>> error.log The error.log file will write all the errors and out.log file write all the output statement. I want to know that, If the size of both file is exceed then, System...

Trying to schedule first cron job, does this schedule look good

cron,crontab
I'm trying to schedule my first cron job: * 0830 * * 1,3,5,0 ls -l I'm expecting the job to run Mon, Wed, Fri, and Sun at 8:30am...

Cron job at specific interval of minutes

cron,crontab,ubuntu-14.04
I need to run a cron job in linux at 20 minutes interval everyday. The most important thing is, it must be on specifically 10th, 30th and 50th minutes. I think I need to run 3 cron jobs as : 10 * * * * /path_to_script 30 * * *...

How to install multiple cron jobs?

linux,shell,crontab,cron-task,cronexpression
the below code for installing multiple cron jobs at a same time using shellscript #!/bin/bash file="/home/admin/Desktop/crontab.sh" file1="/home/admin/Desktop/crontab1.sh" file2="/home/admin/Desktop/crontab2.sh" file3="/home/admin/Desktop/crontab3.sh" echo "$1 $2 $3 $4 $5 $file" >> cron.new echo "$6 $7 $8 $9 $10 $file1" >> cron.new echo "$11 $12 $3 $14 $15 $file2" >> cron.new echo "$16 $17 $18...

Python: How to handle 'crontab' command?

python,linux,ubuntu,cron,crontab
We know the crontab command is used for scheduled tasks in Linux. I want to write a Python script. Its function is to receive some data (these data are related to crontab setting) and execute a 'crontab' command in order to reset the content of the user's crontab file. I...

Why my scheduled job is not working?

linux,centos,crontab,vertica
I define a job with crontab like this 0 2 * * * dbadmin . /home/dbadmin/back.sh it is not root I want to run this .sh file with dbadmin user. but when I checked it is not working. in the log it gives this: Feb 22 21:16:01 localhost crond[14634]: (*system*)...

Using crontab to call wget every 5 minutes

php,symfony2,crontab,wget
I am working on a project where the wget and crontab are used to run a process in the background. I have a php file named "Hello.php" that I want to run this every 5 minutes. I have found that if I want to have a cron job run every...

Run PHP script in crontab only works when exporting to a file

php,linux,centos,crontab
On CentOS release 6.5 (Final): I know that usually I just need to use the following command in crontab to run a php script. 0 * * * * /usr/local/bin/php absolute_path_file_to_the_script.php But, recently, it stopped working. The only work around is to use the following command 0 * * *...

Nitrous.io, Python and Cron not working

python,linux,cron,crontab,nitrousio
Since my script works well when calling it from command line. I'm trying to run this code on schedule with cron: with open('out.txt', 'a') as f: f.write('Hello world! \n') And I've set chmod a+x hello_world.py But I want to run it in Nitrous.io with python3.3, since which python and which...

Crontab restart supervisor python instance?

python,ubuntu,crontab,supervisor,apscheduler
I'm facing a very weird problem while using crontab to restart a supervisor python instance. Here is the details: A very simple Python script which contain some schedule job (apscheduler) The script need to be watched in supervisor, so I made some configuration, and it runs well so far. A...

ubuntu cron job stopped working

shell,ubuntu,crontab,digital-ocean
The cron job used to working well and suddenly stopped working 1 * * * * /usr/bin/python3 /home/roy/update.py It can still run manually on the command line. Then I tried to debug it by the following command: /usr/bin/python3 /home/roy/update.py 2>&1 >> /home/roy/cron_error_report.txt There is no error shown in the cron_error_report.txt...

How to keep Laravel/Redis Queue system running on server

laravel,crontab,artisan
I recently setup a Laravel/Redis Queue system. The basics are a cronjob calls a command which adds jobs to a queue and calls a second command which sends an email. The system works when I ssh into my server and run php artisan queue:listen, but if I close my terminal...

Crontab not running PHP scripts properly

php,crontab
I have the following commands set in my crontab 0 * * * * root cd /home/domain/public_html/webcrawler && php cron1.php 40 * * * * root cd /home/domain/public_html/webcrawler && php cron2.php The thing is they are not running. Is there any noticeable errors in the commands I have set? The...

admin crontab won't run sudo command

crontab,root,cron-task
sudo: no tty present and no askpass program specified Hi I am getting the above error when ever I try to get the following crontab to run. */5 * * * * sudo bash /home/admin/scripts/monitor.sh /dev/null 2>&1 I am using nano as the editor to edit the admin user crontab...

Crontab shell scripting PHP test

php,shell,pipe,crontab
Here is my script (autoRun.sh, and it is executable): date >> testResults.txt php DatabaseTest.php >> testResults.txt And here is my crontab file: 30 11 * * * /Users/myName/Desktop/autoRun.sh DatabaseTest.php and testResults.txt both exist on the desktop with autoRun.sh, but when I check my text file, nothing is in it and...

Run simple Java class file with crontab

java,ubuntu,cron,crontab
I'm trying to run a simple java helloworld program with crontab. I made the following java code: helloworld.java: class HelloWorld { public static void main (String args[]) { System.out.println("Hello world"); } } I then try to run this from a crontab in the following sequence: crontab -e At the end...

How to configuration cron job in cpanel

php,crontab
How to configuration Cron Job in cPanel for .PHP script. I want to run it every day once a day. Where i need to store this .php file ? How can i check whether its working or not ?...