how to create a product that execute a given bash script for linux.

prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

m.radtke hat geschrieben: 28 Sep 2023, 15:20 Hi

you can also download the package locally and start opsi-script locally to see where the script breaks. Exit Code is 1 so there's something wrong.

Regards
Mathias

Sorry for making late attempt. I tried again and analyzed it. The attached log image says, " /bin/bash: line 1: $: command not found" but "/bin/bash" exists.
As per log, the following is the place it breaks with exit code 127:
"/bin/bash -c "$installerSourceDir$ + "/new_touch_script.sh" || exit $?""
The following worked fine on the terminal:
"/bin/bash -c /tmp/new_touch_script.sh" || exit $?" (this working fine)

As you suggested, tried the package locally with opsi-script, and it breaks in the same place mentioned above.

Attached opsi-script log file. Eagerly waiting for your reply.

Edited again to attach the missed log file.

Regards,
arul
Dateianhänge
opsi-script_localrun.log
(22.8 KiB) 67-mal heruntergeladen
Zuletzt geändert von prakash am 17 Okt 2023, 09:53, insgesamt 3-mal geändert.
prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

Maybe I delayed my reply!!

Should i have to start in a fresh thread or this same is this okay to continue?


Regards,
arul
Benutzeravatar
m.radtke
uib-Team
Beiträge: 1534
Registriert: 10 Jun 2015, 12:19

Re: how to create a product that execute a given bash script for linux.

Beitrag von m.radtke »

Hi

could you please attach the opsiscript file?

Regards
Mathias
Kein Support per DM!
_________________________
opsi support - http://www.uib.de/
For productive opsi installations we recommend support contracts.
prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

Thanks Mathias, for your reply.

Attached is setup.opsiscript file.
Dateianhänge
setup.opsiscript.txt
(2.61 KiB) 68-mal heruntergeladen
Benutzeravatar
m.radtke
uib-Team
Beiträge: 1534
Registriert: 10 Jun 2015, 12:19

Re: how to create a product that execute a given bash script for linux.

Beitrag von m.radtke »

Hi

this should work

Code: Alles auswählen

set $exitcode$ = shellCall($installerSourceDir$ + "/new_touch_script.sh")
theres a difference how to use opsi-script variables in primary and secondary sections. Primary sections like this you dont include the variable within the string of the command, in secondary sections, like shellInAnIcon, you do.

Regards
Mathias
Kein Support per DM!
_________________________
opsi support - http://www.uib.de/
For productive opsi installations we recommend support contracts.
prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

Thanks Mathias,

It worked fine on local. Did the correction on opsi-server also, but from opsi-server getting same error. Attaching log image.

While i tried running from server, noticed it gets mounted for short time on "/media/opsi_depot/" with root permission, is it normal?

Thanks and Regards
arul
Dateianhänge
root.PNG
root.PNG (12.85 KiB) 6131 mal betrachtet
while_from_server.PNG
while_from_server.PNG (96.03 KiB) 6131 mal betrachtet
Zuletzt geändert von prakash am 18 Okt 2023, 14:41, insgesamt 2-mal geändert.
Benutzeravatar
m.radtke
uib-Team
Beiträge: 1534
Registriert: 10 Jun 2015, 12:19

Re: how to create a product that execute a given bash script for linux.

Beitrag von m.radtke »

hmmm this seems odd.

could you upload the package somewhere and post the link?
I would like to take a deeper look and ask a colleague.

Regards
Mathias
Kein Support per DM!
_________________________
opsi support - http://www.uib.de/
For productive opsi installations we recommend support contracts.
prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

Thanks for your interest,

Tried creating a new product "l-linux-script" to execute the same script, and got into the same issue, running fine locally but not from the server. Kept a copy of that also.
Kept it in Google Drive @:
https://drive.google.com/drive/folders/ ... sp=sharing

Thanks and Regards
arul
Zuletzt geändert von prakash am 19 Okt 2023, 10:11, insgesamt 3-mal geändert.
prakash
Beiträge: 16
Registriert: 14 Sep 2023, 07:02

Re: how to create a product that execute a given bash script for linux.

Beitrag von prakash »

Hi Mathias,

Have very few hosts installed and installed the license around 2nd week of September. Attached is an image of validation. Hope it is not for validity issues.

Regards,
arul
Dateianhänge
Validity.PNG
Validity.PNG (254.71 KiB) 6102 mal betrachtet
Benutzeravatar
m.radtke
uib-Team
Beiträge: 1534
Registriert: 10 Jun 2015, 12:19

Re: how to create a product that execute a given bash script for linux.

Beitrag von m.radtke »

soooo

it works with

Code: Alles auswählen

set $exitcode$ = shellCall($installerSourceDir$ + '/new_touch_script.sh')
As the opsi-script interpreter uses double quotes arround the shellCall itself while interpreting, you have to use single quotes for the string part of the shellCall

Code: Alles auswählen

root@debian:~# ls -l /tmp | grep helloo
-rw-r--r-- 1 root root    0 19. Okt 10:04 hellooooooo_opsi.txt
Regards

Mathias
Kein Support per DM!
_________________________
opsi support - http://www.uib.de/
For productive opsi installations we recommend support contracts.
Antworten