Ticket Commands in generic Agent not working
Moderator: crythias
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Ticket Commands in generic Agent not working
Hi All,
I am trying to run an external script with generic agent using CMD in ticket commands but it doesn't work.
Also, there is nothing in the logs.
what i am doing is:
Script is placed in /opt/otrs/bin/cgi-bin/script.sh
CMD : sh script.sh
Also, I tried using simple commands to print ticket Number into one file using command :
echo ARG[0] >& /tmp/check.log
echo ARG[0] > /tmp/check.log
Neither of them worked.
This is the permission to folder /opt/otrs
================================================
drwxr-xr-x 11 otrs apache 4096 Nov 14 14:58 otrs
================================================
Please help. Thanks in Advance
Regards,
Nitin Khaneja
I am trying to run an external script with generic agent using CMD in ticket commands but it doesn't work.
Also, there is nothing in the logs.
what i am doing is:
Script is placed in /opt/otrs/bin/cgi-bin/script.sh
CMD : sh script.sh
Also, I tried using simple commands to print ticket Number into one file using command :
echo ARG[0] >& /tmp/check.log
echo ARG[0] > /tmp/check.log
Neither of them worked.
This is the permission to folder /opt/otrs
================================================
drwxr-xr-x 11 otrs apache 4096 Nov 14 14:58 otrs
================================================
Please help. Thanks in Advance
Regards,
Nitin Khaneja
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Ticket Commands in generic Agent not working
In the generic agent it should be
And in the shell script
Code: Select all
sh /opt/otrs/bin/cgi-bin/script.sh
Code: Select all
echo $1 >> /tmp/check.log
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi Reneeb,
Thanks for your reply.
I did this too. Still i am not able to trigger anything from CMD in ticket Commands in generic agent.
Kindly Suggest.
Regards,
Nitin Khaneja
Thanks for your reply.
I did this too. Still i am not able to trigger anything from CMD in ticket Commands in generic agent.
Kindly Suggest.
Regards,
Nitin Khaneja
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Ticket Commands in generic Agent not working
Set the MinimumLogLevel to "debug" in SysConfig, run the GenericAgent manually and check the OTRS log
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi,
Thanks for your reply.
I made the changes and there are certain logs generated.
======================================================================================================================
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::JobRun] Run GenericAgent Job 'scriptt' from db.
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111301000045/156).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111401000016/157).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111501000014/158).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111501000023/159).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111601000012/160).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018112101000011/161).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018112101000021/162).
========================================================================================================================
It shows script is getting executed but if i check on server, It is not executed.
What could be the issue?
Please help.
Regards,
Nitin Khaneja
Thanks for your reply.
I made the changes and there are certain logs generated.
======================================================================================================================
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::JobRun] Run GenericAgent Job 'scriptt' from db.
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111301000045/156).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111401000016/157).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111501000014/158).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111501000023/159).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018111601000012/160).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018112101000011/161).
[Thu Nov 22 16:06:08 2018][Notice][Kernel::System::GenericAgent::_JobRunTicket] Execute 'sh /opt/otrs/bin/cgi-bin/ans.sh' for Ticket (2018112101000021/162).
========================================================================================================================
It shows script is getting executed but if i check on server, It is not executed.
What could be the issue?
Please help.
Regards,
Nitin Khaneja
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
I have also tried running the script manually from CLI using 'OTRS' user. It is working fine.
but not working from generic agent.
Kindly help.
but not working from generic agent.
Kindly help.
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi All,
Kindly Suggest. Issue is still not resolved.
Kindly Suggest. Issue is still not resolved.
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Ticket Commands in generic Agent not working
Do you have a relative path to the output file in your .sh or an absolute one? Can you show the ans.sh file?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi Reneeb,
Thanks for your reply.
This is the ans.sh file.
=================================
#!/bin/bash
echo `date` >> /tmp/check.log
=================================
No check.log file is made in /tmp folder.
Regards,
Nitin Khaneja
Thanks for your reply.
This is the ans.sh file.
=================================
#!/bin/bash
echo `date` >> /tmp/check.log
=================================
No check.log file is made in /tmp folder.
Regards,
Nitin Khaneja
-
- Administrator
- Posts: 3983
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Ticket Commands in generic Agent not working
Hi,
Did you check the permissions of /tmp/check.log? This file can be written from the OTRS daemon and / or the web server, usually they run with different users.
- Roy
Did you check the permissions of /tmp/check.log? This file can be written from the OTRS daemon and / or the web server, usually they run with different users.
- 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: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi Roy,
I have checked permission of /tmp/check/log file. It is correct.
=============================================
-rw-rw-rw- 1 otrs apache 58 Nov 27 02:32 check.log
=============================================
and OTRS is able to manually run the script.
Please help.
Regards,
Nitin Khaneja
I have checked permission of /tmp/check/log file. It is correct.
=============================================
-rw-rw-rw- 1 otrs apache 58 Nov 27 02:32 check.log
=============================================
and OTRS is able to manually run the script.
Please help.
Regards,
Nitin Khaneja
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Issue is still pending. Please help.
Regards,
Nitin Khaneja
Regards,
Nitin Khaneja
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
Hi Team,
I am getting this error while executing Generic Agent Command.
=============================================================================================================================
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Can't send to 'root@localhost': 5505.7.1 Unable to relay
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 There was an error executing Execute() in Kernel::System::Console::Command::Maint::GenericAgent::Run: ERROR: OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Perl: 5.16.3 OS: linux Time: Wed Dec 12 11:20:13 2018
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Module <ModuleName>.pm not in @INC (/opt/otrs/Custom /opt/otrs/Kernel/cpan-lib /opt/otrs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Kindly Suggest.
Regards,
Nitin Khaneja
I am getting this error while executing Generic Agent Command.
=============================================================================================================================
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Can't send to 'root@localhost': 5505.7.1 Unable to relay
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 There was an error executing Execute() in Kernel::System::Console::Command::Maint::GenericAgent::Run: ERROR: OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Perl: 5.16.3 OS: linux Time: Wed Dec 12 11:20:13 2018
Wed Dec 12 11:20:13 2018 error OTRS-otrs.Console.pl-Maint::GenericAgent::Run-01 Module <ModuleName>.pm not in @INC (/opt/otrs/Custom /opt/otrs/Kernel/cpan-lib /opt/otrs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Kindly Suggest.
Regards,
Nitin Khaneja
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Ticket Commands in generic Agent not working
Is it a module, you created? If not, which module is it?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 10
- Joined: 08 Oct 2018, 14:11
- Znuny Version: Community
- Real Name: Nitin
- Company: Tech Mahindra limited
Re: Ticket Commands in generic Agent not working
I didn't make any module. I did not make any changes but this is what i found in logs.
I am still facing issue running command on generic agent. Please help.
Regards,
Nitin Khaneja
I am still facing issue running command on generic agent. Please help.
Regards,
Nitin Khaneja
-
- Znuny newbie
- Posts: 12
- Joined: 30 Jan 2021, 07:51
- Znuny Version: 6 community
- Real Name: Vincent B.
A possible solution [Re: Ticket Commands in generic Agent not working]
I had the same issue (apparently unable to create/write a file into /tmp from a bash script invoked by a generic agent)
So, for the records, I write here what was for me the solution (on CentOS).
The file was in fact written, but instead of being written in /tmp, it was written in a subdirectory of /tmp (in my case: /tmp/systemd-private-9249ca4931894c8188c41e01a43a37ee-httpd.service-kuz6g2/tmp).
This is a "security feature" called "private tmp", discussed here https://blog.oddbit.com/post/2012-11-05 ... ivate-tmp/
I identified the solution thanks to this article: https://stackoverflow.com/questions/107 ... edir-value
So, for the records, I write here what was for me the solution (on CentOS).
The file was in fact written, but instead of being written in /tmp, it was written in a subdirectory of /tmp (in my case: /tmp/systemd-private-9249ca4931894c8188c41e01a43a37ee-httpd.service-kuz6g2/tmp).
This is a "security feature" called "private tmp", discussed here https://blog.oddbit.com/post/2012-11-05 ... ivate-tmp/
I identified the solution thanks to this article: https://stackoverflow.com/questions/107 ... edir-value
-
- Administrator
- Posts: 3983
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: A possible solution [Re: Ticket Commands in generic Agent not working]
Hi,vincentb wrote: ↑14 Apr 2021, 09:49 I had the same issue (apparently unable to create/write a file into /tmp from a bash script invoked by a generic agent)
So, for the records, I write here what was for me the solution (on CentOS).
The file was in fact written, but instead of being written in /tmp, it was written in a subdirectory of /tmp (in my case: /tmp/systemd-private-9249ca4931894c8188c41e01a43a37ee-httpd.service-kuz6g2/tmp).
This is a "security feature" called "private tmp", discussed here https://blog.oddbit.com/post/2012-11-05 ... ivate-tmp/
I identified the solution thanks to this article: https://stackoverflow.com/questions/107 ... edir-value
It is a security feature. And the proper solution is not to disable this. Implement your scripts by using mktemp to create temporary files or sth. like logger to log messages.
- 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 ?