Generic Agent cmd execution [Solved]
Moderator: crythias
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Generic Agent cmd execution [Solved]
Hi,
I'm tring to run custom scripts by generic agents jobs on OTRS 6.0.26 in a CentOS system. However is not working.
I've tried to disable firewall and selinux. I've already have checked the permissions on my script and the script file log. Both has the otrs user as owner and makes part of apache group.
The interesting thing of this is that I am able to run the same script on the OTRS in a Ubuntu system. I just have problem on CentOS.
Somebody can share some tip to help me to solve this?
Thanks.
I'm tring to run custom scripts by generic agents jobs on OTRS 6.0.26 in a CentOS system. However is not working.
I've tried to disable firewall and selinux. I've already have checked the permissions on my script and the script file log. Both has the otrs user as owner and makes part of apache group.
The interesting thing of this is that I am able to run the same script on the OTRS in a Ubuntu system. I just have problem on CentOS.
Somebody can share some tip to help me to solve this?
Thanks.
Last edited by ronil21 on 26 Feb 2020, 19:34, edited 3 times in total.
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Generic Agent cmd execution
Hi,
Let's start by showing us your GenericAgent configuration.
- Roy
Let's start by showing us your GenericAgent configuration.
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
Hi Roy,
Attached an screenshot of the GenericAgent Configuration.
Thanks
Attached an screenshot of the GenericAgent Configuration.
Thanks
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Generic Agent cmd execution
Hi,
Is it the same command as under the other OS? I never tried two arguments, I would chmod+x the script and just put /opt/otrs/bin/ping.sh in.
Did you tested the script by executing it with the OTRS user?
- Roy
Is it the same command as under the other OS? I never tried two arguments, I would chmod+x the script and just put /opt/otrs/bin/ping.sh in.
Did you tested the script by executing it with the OTRS user?
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
Yes, is the same command in both systems.
No, I didn't test the script using the otrs user by cli. I will try now and also try execute the command without the "/bin/sh" arguments.
Soon I will update this forum.
Thank you.
No, I didn't test the script using the otrs user by cli. I will try now and also try execute the command without the "/bin/sh" arguments.
Soon I will update this forum.
Thank you.
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
Interesting, with the OTRS user by cli is not working the script is not running. I will check that. But do you have some tip? Because the script theoretically already have the necessary permissions.
1078813 4,0K -rwxr-xr-x 1 otrs apache 56 Fev 21 22:19 ping.sh
5658149 0 -rw-r--r-- 1 otrs apache 0 Fev 26 12:30 testeping.log
Thanks
1078813 4,0K -rwxr-xr-x 1 otrs apache 56 Fev 21 22:19 ping.sh
5658149 0 -rw-r--r-- 1 otrs apache 0 Fev 26 12:30 testeping.log
Thanks
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Generic Agent cmd execution
Hi,
Is there any error during execution? I suggest to fix your script first until you run it through the GenericAgent
- Roy
Is there any error during execution? I suggest to fix your script first until you run it through the GenericAgent
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
There is no error on execution. However I've change now the directory where my script was. Now it is on "/opt/otrs" and now by cli with the OTRS user the script runs, but still is not working from the GenericAgent.
[root@srv-otrs otrs]# su - otrs -c '/opt/otrs/ping.sh'
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> testeping.log
[root@srv-otrs otrs]# pwd
/opt/otrs
==================================================================
[root@srv-otrs ~]# tail -f /opt/otrs/testeping.log
PING www.google.com.br (172.217.30.67) 56(84) bytes of data.
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=1 ttl=49 time=55.0 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=2 ttl=49 time=53.7 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=3 ttl=49 time=69.6 ms
--- www.google.com.br ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 53.757/59.510/69.690/7.218 ms
PING www.google.com.br (172.217.30.67) 56(84) bytes of data.
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=1 ttl=49 time=52.2 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=2 ttl=49 time=66.3 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=3 ttl=49 time=108 ms
--- www.google.com.br ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 52.268/75.647/108.329/23.813 ms
[root@srv-otrs otrs]# su - otrs -c '/opt/otrs/ping.sh'
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> testeping.log
[root@srv-otrs otrs]# pwd
/opt/otrs
==================================================================
[root@srv-otrs ~]# tail -f /opt/otrs/testeping.log
PING www.google.com.br (172.217.30.67) 56(84) bytes of data.
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=1 ttl=49 time=55.0 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=2 ttl=49 time=53.7 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=3 ttl=49 time=69.6 ms
--- www.google.com.br ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 53.757/59.510/69.690/7.218 ms
PING www.google.com.br (172.217.30.67) 56(84) bytes of data.
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=1 ttl=49 time=52.2 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=2 ttl=49 time=66.3 ms
64 bytes from gru06s34-in-f3.1e100.net (172.217.30.67): icmp_seq=3 ttl=49 time=108 ms
--- www.google.com.br ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 52.268/75.647/108.329/23.813 ms
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Generic Agent cmd execution
Hi
Set the SysConfig MinimumDebugLevel to debug execute the GA and check otrs and web server log.
- Roy
Set the SysConfig MinimumDebugLevel to debug execute the GA and check otrs and web server log.
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny superhero
- Posts: 890
- Joined: 15 Dec 2016, 15:13
- Znuny Version: All
- Real Name: Emin
- Company: Efflux GmbH
- Contact:
Re: Generic Agent cmd execution
Hey,
You're most likely just having a permission problem.
CMD: /opt/otrs/ping.sh and get sure that the Generic Agent is having a match =).
The apache log, as told already, will tell you if there are any problems.
Best regards
Emin
Edit: Get sure to use an absolute and not a relative path in your script.
You're most likely just having a permission problem.
Code: Select all
touch /opt/otrs/testeping.log
/opt/otrs/portal/bin/otrs.SetPermissions.pl
The apache log, as told already, will tell you if there are any problems.
Best regards
Emin
Edit: Get sure to use an absolute and not a relative path in your script.
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/
Free and premium add-ons: German | English
Free and premium add-ons: German | English
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
Roy,
Was a permission problem in the log file of the script. I could solve changing the path to the file
[root@srv-otrs otrs]# tail -f /var/log/httpd/error_log
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
Module: ModPerl::Registry::handler (v1.99) Line: 32
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
Before was:
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> testeping.log
And now is:
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> /opt/otrs/testeping.log
Thank you very much for you help
Was a permission problem in the log file of the script. I could solve changing the path to the file
[root@srv-otrs otrs]# tail -f /var/log/httpd/error_log
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
Module: ModPerl::Registry::handler (v1.99) Line: 32
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
/opt/otrs/ping.sh: line 3: testeping.log: Permission denied
Before was:
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> testeping.log
And now is:
[root@srv-otrs otrs]# cat ping.sh
#!/bin/sh
ping -c 3 www.google.com.br >> /opt/otrs/testeping.log
Thank you very much for you help
-
- Znuny newbie
- Posts: 15
- Joined: 16 May 2017, 20:41
- Znuny Version: OTRS Version 5
- Real Name: Ronil Estevam
Re: Generic Agent cmd execution
Was exactly this.
Thank you all.
Thank you all.
zzz wrote: ↑26 Feb 2020, 19:19 Hey,
You're most likely just having a permission problem.
CMD: /opt/otrs/ping.sh and get sure that the Generic Agent is having a match =).Code: Select all
touch /opt/otrs/testeping.log /opt/otrs/portal/bin/otrs.SetPermissions.pl
The apache log, as told already, will tell you if there are any problems.
Best regards
Emin
Edit: Get sure to use an absolute and not a relative path in your script.
-
- Znuny newbie
- Posts: 26
- Joined: 27 Apr 2020, 14:28
- Znuny Version: 6.0.27
- Real Name: Ashwini Gore
- Company: Alepo
Re: Generic Agent cmd execution [Solved]
guys I am unable to execute external script using generic agent - OTRS 6.0.27 version
1. able to run samplecommandlineprog.sh using otrs user
2. it is just hello world kind of one liner script
3. permission are as follows
-rwxr-xr-x. 1 otrs apache 64 Apr 27 17:37 samplecommandlineprog.sh
-rw-r--r--. 1 otrs apache 39 Apr 28 16:10 sample.log
4. I am getting below error when i do run this job in tail -f /var/log/httpd/error_log
[Tue Apr 28 16:29:24 2020] -e: Reference found where even-sized list expected at /opt/otrs//Kernel/System/GenericAgent.pm line 988.
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 9: package: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 11: use: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 12: use: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 14: syntax error near unexpected token `('
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 14: `our @ObjectDependencies = ('
5. generic agent interface
CMD = /bin/bash /opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm
1. able to run samplecommandlineprog.sh using otrs user
2. it is just hello world kind of one liner script
3. permission are as follows
-rwxr-xr-x. 1 otrs apache 64 Apr 27 17:37 samplecommandlineprog.sh
-rw-r--r--. 1 otrs apache 39 Apr 28 16:10 sample.log
4. I am getting below error when i do run this job in tail -f /var/log/httpd/error_log
[Tue Apr 28 16:29:24 2020] -e: Reference found where even-sized list expected at /opt/otrs//Kernel/System/GenericAgent.pm line 988.
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 9: package: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 11: use: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 12: use: command not found
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 14: syntax error near unexpected token `('
/opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm: line 14: `our @ObjectDependencies = ('
5. generic agent interface
CMD = /bin/bash /opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Generic Agent cmd execution [Solved]
Hi,ashwinigore wrote: ↑28 Apr 2020, 13:01 5. generic agent interface
CMD = /bin/bash /opt/otrs/scripts/test/sample/GenericAgent/TestGenericAgent.pm
First of all: please don't hijack old threads. Second: are you sure you know what you're doing there? You start an OTRS GenericAgent module with the bash?
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 26
- Joined: 27 Apr 2020, 14:28
- Znuny Version: 6.0.27
- Real Name: Ashwini Gore
- Company: Alepo
Re: Generic Agent cmd execution [Solved]
sorry but i am new to forum and couldn't get option where to submit post
What i want to call some command line program when any ticket is generated. So created one shell script. I am new to OTRS, please guide if I can use any other feature to call some external shell/perl/python script on specific operation like create or update ticket
What i want to call some command line program when any ticket is generated. So created one shell script. I am new to OTRS, please guide if I can use any other feature to call some external shell/perl/python script on specific operation like create or update ticket