SOLVED Cron job via webui for a jail task

Status
Not open for further replies.

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
I'm trying to run a cronjob from the webUI jexec Apps flock -n /media/Scripts/mm.lock -c "/media/Scripts/MediaMgmt_local.py -v" as the user media but it doesnt run. It runs if i make the user root

Sent from my SM-G950W using Tapatalk
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Did you have a question about something?
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
yes how to make it run under media since when it is set to use media as user, nothing runs. If i ssh into the jail and su media and run the script, it runs just fine.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
So if it runs as root from the GUI and successfully executes why does it matter?
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
So if it runs as root from the GUI and successfully executes why does it matter?

because the files that the script moves are set to root as owner instead of media which causes sonarr to throw up a access denied on my file
 

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
You probably want the command jexec.

From the man page:
Code:
NAME
  jexec -- execute a command inside an existing jail

SYNOPSIS
  jexec [-l] [-u username | -U username] jail [command ...]
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
You probably want the command jexec.

From the man page:
Code:
NAME
  jexec -- execute a command inside an existing jail

SYNOPSIS
  jexec [-l] [-u username | -U username] jail [command ...]


Code:
jexec Apps flock -n /media/Scripts/mm.lock -c "/media/Scripts/MediaMgmt_local.py -v"


Works with root but not if i set it with media
 

Joshua Walker

Dabbler
Joined
May 8, 2017
Messages
23
so i added the shell to the media user

Code:
[root@srv-saitoh-app] ~# pw user mod media -s /bin/csh
[root@srv-saitoh-app] ~# grep media /etc/passwd
media:*:8675309:8675309:Media User:/var/empty:/bin/csh


Then i su into media and ran the script and i get this error. Which i guess must be the error i get from the cron job as well.

Code:
[root@srv-saitoh-app] ~# su media
[media@srv-saitoh-app] /root% jexec Apps flock -n /media/Scripts/mm.lock -c "/media/Scripts/MediaMgmt_local.py -v"
jexec: jail_attach(1): Operation not permitted


$PATH of media:

Code:
[media@srv-saitoh-app] /root% $PATH
/var/empty/bin:/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/usr/sbin: Command not found.


$PATH of root:

Code:
[root@srv-saitoh-app] ~# $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin:/usr/local/fusion-io: Command not found.


But using

Code:
jexec -u media Apps flock -n /media/Scripts/mm.lock -c "/media/Scripts/MediaMgmt_local.py -v"


seems to work now since i added the shell to media. So its a workaround i guess
 
Status
Not open for further replies.
Top