Forum Discussion

Nikoolayy1's avatar
Jan 17, 2023

iCall script triggers error need ${HOME} to run

I have checked article https://community.f5.com/t5/technical-articles/what-is-icall/ta-p/288206 and https://support.f5.com/csp/article/K14397 for iCall scripts.

 

I am trying to execute a linux command on F5 HA device sync messages with an icall script when I see a particular device sync message  but I get the below error:

Ltm log:

014f0013:3: Script (/Common/xxx_sync) generated this Tcl error: (script did not successfully complete: (xxx: need ${HOME} but not set and no default

Audit log:

Jan 17 04:30:47 xxxx notice scriptd[14290]: 014f0005:5: AUDIT - user=root action="event-triggered handler, run script: /Common/xxx_sync" status="script did not successfully complete: (xxx: need ${HOME} but not set and no default

 

 

root@(xxx)(cfg-sync Standalone)(Active)(/Common)(tmos)# list sys icall
sys icall handler triggered xxx_sync {
script xxx_sync
subscriptions {
xxx_sync {
event-name xxx_sync
}
}
}
sys icall script xxx_sync {
app-service none
definition {
exec bash /var/tmp/xxx_bash.sh
}
description none
events none
}

 

I tried triggering the script with "exec bash <bash script>", so that it is not the linux command directly in the bash field but still the same error and when I run the command or script no issues, so I think the the icall script process/user just does not have a $HOME directory like me, so when it runs the Linux command or script I get the error as the command wants $HOME directory.

 

Any ideas how to set the iCALL scriptd process's HOME directory? Strange that iCALL seems to use the root user and the home dir should be root.

 

[root@xxxxx:Active:Standalone] tmp # cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
tmshnobody:x:32765:32765:tmshnobody:/:/sbin/nologin
admin:x:0:500:Admin User:/home/admin:/bin/false
vcsa:x:69:69:virtual console memory owner:/dev:/sbin

 

 

  • What happens if you call the shell script directly? An example would be "exec /var/tmp/xxx_bash.sh" ... does that retain the environment variable to allow it to run successfully?

    • If i run the script myself yes there is no issue as that is the first thing I checked but I have now some leads, so I will do more testing. Still I used "bash script.sh" or "./script.sh" for personal tests, so maybe the "exec" changes the shell, so a nice suggestion.

      • G-Rob's avatar
        G-Rob
        Icon for Employee rankEmployee

        I don't think "exec" necessarily changes the shell, but "exec bash script.sh" vs "exec script.sh" would launch a child BASH process, most likely without the environmental variables you need. Can you try without specifying bash and let me know how it goes?