Skip to main content
deleted 20 characters in body
Source Link
Caleb
  • 12.1k
  • 4
  • 39
  • 49

For some reason my cronjob is not working:

4 20 * * * /home/ubuntu/db_backup/myScript.sh 1 > /home/ubuntu/db_backup/cron_log.txt 

And my bash script looks like this:

#! /bin/bash mysqldump -h anotherhost -P 3306 -u usen -pmypass --all-databases > $1.sql java -jar myJar.jar param1 $1.sql 

So the jar file takes in 2 parameters, the first one i want always to be the same, the second one comes from the first bash parameter. Inside /var/spool/mail/ubuntu I see this error:

Unable to access jarfile myJar.jar

I set the crontab up under user: ubuntu

owner and group of the jar file is ubuntu and it has octal permissions of 700.

What am I doing wrong?

Thanks!

For some reason my cronjob is not working:

4 20 * * * /home/ubuntu/db_backup/myScript.sh 1 > /home/ubuntu/db_backup/cron_log.txt 

And my bash script looks like this:

#! /bin/bash mysqldump -h anotherhost -P 3306 -u usen -pmypass --all-databases > $1.sql java -jar myJar.jar param1 $1.sql 

So the jar file takes in 2 parameters, the first one i want always to be the same, the second one comes from the first bash parameter. Inside /var/spool/mail/ubuntu I see this error:

Unable to access jarfile myJar.jar

I set the crontab up under user: ubuntu

owner and group of the jar file is ubuntu and it has octal permissions of 700.

What am I doing wrong?

Thanks!

For some reason my cronjob is not working:

4 20 * * * /home/ubuntu/db_backup/myScript.sh 1 > /home/ubuntu/db_backup/cron_log.txt 

And my bash script looks like this:

#! /bin/bash mysqldump -h anotherhost -P 3306 -u usen -pmypass --all-databases > $1.sql java -jar myJar.jar param1 $1.sql 

So the jar file takes in 2 parameters, the first one i want always to be the same, the second one comes from the first bash parameter. Inside /var/spool/mail/ubuntu I see this error:

Unable to access jarfile myJar.jar

I set the crontab up under user: ubuntu

owner and group of the jar file is ubuntu and it has octal permissions of 700.

What am I doing wrong?

Source Link
Doug Molineux
  • 433
  • 3
  • 7
  • 17

Running a JAR from a bash script in a cronjob

For some reason my cronjob is not working:

4 20 * * * /home/ubuntu/db_backup/myScript.sh 1 > /home/ubuntu/db_backup/cron_log.txt 

And my bash script looks like this:

#! /bin/bash mysqldump -h anotherhost -P 3306 -u usen -pmypass --all-databases > $1.sql java -jar myJar.jar param1 $1.sql 

So the jar file takes in 2 parameters, the first one i want always to be the same, the second one comes from the first bash parameter. Inside /var/spool/mail/ubuntu I see this error:

Unable to access jarfile myJar.jar

I set the crontab up under user: ubuntu

owner and group of the jar file is ubuntu and it has octal permissions of 700.

What am I doing wrong?

Thanks!