Post job bash scripts

cPanel, Industry leading hosting platform with world-class support.
Post Reply
havri
Posts: 22
Joined: August 10th, 2017, 4:10 pm

Post job bash scripts

Post by havri »

Hello,

I added a couple of post job bash scripts that analyze some parts of the log. The problem is that the results I get are different and limited in comparison with when I run them as root through SSH.

These two scripts analyze the jet backup log and put some statistics in a .txt file which after that I export. I looked at the log file and everything seems ok:

Code: Select all

[10/Aug/2017 14:35:22 +0000] Executing post job scripts...
[10/Aug/2017 14:35:22 +0000] 	Executing `/root/scr/myscript.sh -jt`...SUCCESS
[10/Aug/2017 14:35:22 +0000] 	Executing `/root/scr/myscript.sh -jp`...SUCCESS
[10/Aug/2017 14:35:22 +0000] Job Completed.
If I run the same script through a simple cron, the resulted output is correct.

From what I tested, there seems to be a permission or environment issue with the post job scripts. Is there a way to debug this or can someone point me in the right direction? Alternatively, is there a way to add some hooks to run my scripts after the backup job is done?

Thank you.
alex
Posts: 5
Joined: February 10th, 2017, 9:11 pm

Re: Post job bash scripts

Post by alex »

It appears to be an issue particular to your environment. Please create a ticket with our help desk by emailing support@jetapps.com or visiting the link below because we MAY need access to your servers and don't want to work over a public forum, for security concerns. Thank you!

https://www.jetapps.com/support
User avatar
elialum
Staff Member
Staff Member
Posts: 95
Joined: October 25th, 2015, 1:44 pm

Re: Post job bash scripts

Post by elialum »

Hi,

Just a follow up's to Alex's response, please try the following -

1. print the environment from ssh running as root (printenv).
2. do the same from the cron (print output to a file)
3. compare them, add the missing env variables to the cron

For example -

Code: Select all

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /root
export TERM=vt100
export SHELL=/bin/bash
Hope it helps :)

Thanks,
Eli.
havri
Posts: 22
Joined: August 10th, 2017, 4:10 pm

Re: Post job bash scripts

Post by havri »

Hello,

@alex as a result of tests, I will open a ticket.

@elialum I forgot to update this thread. That's exactly what I did and found out that the env for the jetbackup scripts was empty, so I exported what I needed in the bash script, but the problem still persists.

Thank you.
User avatar
elialum
Staff Member
Staff Member
Posts: 95
Joined: October 25th, 2015, 1:44 pm

Re: Post job bash scripts

Post by elialum »

Hi,

Thank you for the update about your issue.
Please let us know if you need further assistance :)

Eli.
Post Reply