Download and execute my script on Linux client

(imported topic written by SystemAdmin)

Hi guys,

suppose I have a shell script.sh that I want to execute on Linux client.

Can you provide me with an action script to use in a task that downloads this file and executes it?

My main concern is what I need to do for a client to be able to download it from TEM Server. Should I put it in sha1 folder like here: http://support.bigfix.com/cgi-bin/kbdirect.pl?id=500 under the name of its sha1? And what path should I then give for a download command?

Here a guy puts it in Uploads folder and does not change the name: http://forum.bigfix.com/viewtopic.php?id=6519

So what is the proper way? Action script code and a path to file on TEM Server would be much appretiated.

Regards

Piotr

(imported comment written by BenKus)

Here are two ways:

Download and run the .sh file:

http://forum.bigfix.com/viewtopic.php?pid=9220#p9220

Put the .sh file in actionscript:

http://forum.bigfix.com/viewtopic.php?pid=10748#p10748

Ben

(imported comment written by SystemAdmin)

Thanks Ben.

The instructions say to put all the script code directly in the fixlet/task with appendfile.

I thought about creating a separate file .sh or .sql , sending it and then only executing it from action script.

Actually at the moment I have several sql scripts to run on Oracle db. So I need to execute sth like this:

sqlplus userid/password@db -s @myscript1.sql

I thought I should send, or rather tell client to gather myscript1.sql from server first and then execute it. Is it good approach? If it is where should I put this sql on server and what command should be used to gather it?

(imported comment written by BenKus)

Hi piotr,

There won’t be a good way to get the userid/pw to the agent securely. If you put it in the Fixlet, people can see it and if you make it a download, then other people can easily download it too.

Ben

(imported comment written by SystemAdmin)

Maybe I could use parametrized action for that.

But what do you think about the idea of sending the entire sql file as a file and then executing it?

(imported comment written by BenKus)

That is fine… it won’t be secure in any of these cases, but you can certainly download the script and use it…

Ben