OPNsense Forum

English Forums => Development and Code Review => Topic started by: guest32123 on February 19, 2022, 06:29:52 pm

Title: Executing bash script with cron
Post by: guest32123 on February 19, 2022, 06:29:52 pm
Hello ;D,

i would like to execute a bash/sh script with cron.
i made actions_bashscript.conf in /usr/local/opnsense/service/conf/actions.d/
File contains:
[load]                                                                         
 command:/usr/local/opnsense/scripts/shell/bash.sh                 
 parameters:                                                                     
 type:script                                                                     
 message: Run bash script                                   
 description: Run bash script

After creating the file, I restarted configd with: service configd restart
Then I executed the file with configctl bashscript load. The output was [OK]
But the script didn't make a directory in /root/ for me.

if I run the script with /usr/local/opnsense/scripts/shell/bash.sh
It will create a directory

What do I miss?  ???

Thanks in advance.
Title: Re: Executing bash script with cron
Post by: guest32123 on February 19, 2022, 07:24:14 pm
My bad, I think I placed this topic in the wrong section.
If someone can move it, please do  :-[
Title: Re: Executing bash script with cron
Post by: franco on February 19, 2022, 07:42:19 pm
This section is fine. you can change "type" to "script_output and debug with stdout (echo).


Cheers,
Franco
Title: Re: Executing bash script with cron
Post by: fabian on February 19, 2022, 09:59:09 pm
bash has debug options. See "set -x"