Discussion:
[SCRIT] - One execution
March, Agustin M
2008-02-27 20:24:42 UTC
Permalink
Hi,
I need to rum some script right after the installation wa done.
I use the script adding ngedit tool, however, the script are executed
every boot.
Are any mechanism to execute the script one time after the installation
?

Regards,

Agustin March <mailto:***@intel.com>
Argentina Distributing Computing Solution
Mark Black
2008-02-27 20:58:48 UTC
Permalink
Hi Agustin

How about just deleteing its self at the bottom of the script? That would cause it to run one time.

Was this added as a custom script in ngedit, or a kusu rc script?


Mark

-----Original Message-----
From: kusu-users-***@osgdc.org
[mailto:kusu-users-***@osgdc.org]On Behalf Of March, Agustin M
Sent: Wednesday, February 27, 2008 3:25 PM
To: kusu-***@osgdc.org
Subject: [Kusu-users] [SCRIT] - One execution


Hi,
I need to rum some script right after the installation wa done.
I use the script adding ngedit tool, however, the script are executed
every boot.
Are any mechanism to execute the script one time after the installation
?

Regards,

Agustin March <mailto:***@intel.com>
Argentina Distributing Computing Solution
March, Agustin M
2008-02-28 12:04:11 UTC
Permalink
Mark,


It was added as custom script in ngedit. I don't; know about kusu rc.
Could you explain about the kusu rc? Is this tool intended for this use?

Regards,
Agustin

-----Original Message-----
From: kusu-users-***@osgdc.org [mailto:kusu-users-***@osgdc.org]
On Behalf Of Mark Black
Sent: Wednesday, February 27, 2008 6:59 PM
To: Users of Kusu
Subject: RE: [Kusu-users] [SCRIT] - One execution

Hi Agustin

How about just deleteing its self at the bottom of the script? That
would cause it to run one time.

Was this added as a custom script in ngedit, or a kusu rc script?


Mark

-----Original Message-----
From: kusu-users-***@osgdc.org
[mailto:kusu-users-***@osgdc.org]On Behalf Of March, Agustin M
Sent: Wednesday, February 27, 2008 3:25 PM
To: kusu-***@osgdc.org
Subject: [Kusu-users] [SCRIT] - One execution


Hi,
I need to rum some script right after the installation wa done.
I use the script adding ngedit tool, however, the script are executed
every boot.
Are any mechanism to execute the script one time after the installation
?

Regards,

Agustin March <mailto:***@intel.com>
Argentina Distributing Computing Solution
Mike Mazur
2008-02-28 12:38:00 UTC
Permalink
Hi Augustin,

On Thu, 28 Feb 2008 04:04:11 -0800
Post by March, Agustin M
It was added as custom script in ngedit. I don't; know about kusu rc.
Could you explain about the kusu rc? Is this tool intended for this use?
There is a directory /etc/rc.kusu.d in which scripts can be placed.
During boot a tool called kusurc is executed. kusurc looks
in /etc/rc.kusu.d and executes any scripts it finds there.

If we want a script to be only run once, we simply tell the script to
remove itself at the end. An example of a bash script that does this is:

#!/bin/bash

# ... your code here ...

rm $0 # this line removes this script

You will also find Python files in /etc/rc.kusu.d. These files define a
class KusuRC that inherits from kusu.core.rcplugin.Plugin. Objects of
this class have an attribute called delete. If the delete attribute is
set to True, the plugin will be deleted after kusurc executes it.

Take a look at /etc/rc.kusu.d/S02KusuSSHHosts.rc.py for example. On
line 18 you see self.delete = False. If this was set to True, this
plugin would be removed.

HTH
Mike
March, Agustin M
2008-02-29 11:06:27 UTC
Permalink
Hi Mike,
It is a good approach!
Regards
Agustin

-----Original Message-----
From: Mike Mazur [mailto:***@osgdc.org]
Sent: Thursday, February 28, 2008 10:38 AM
To: Users of Kusu
Cc: March, Agustin M
Subject: Re: [Kusu-users] [SCRIT] - One execution

Hi Augustin,

On Thu, 28 Feb 2008 04:04:11 -0800
Post by March, Agustin M
It was added as custom script in ngedit. I don't; know about kusu rc.
Could you explain about the kusu rc? Is this tool intended for this use?
There is a directory /etc/rc.kusu.d in which scripts can be placed.
During boot a tool called kusurc is executed. kusurc looks
in /etc/rc.kusu.d and executes any scripts it finds there.

If we want a script to be only run once, we simply tell the script to
remove itself at the end. An example of a bash script that does this is:

#!/bin/bash

# ... your code here ...

rm $0 # this line removes this script

You will also find Python files in /etc/rc.kusu.d. These files define a
class KusuRC that inherits from kusu.core.rcplugin.Plugin. Objects of
this class have an attribute called delete. If the delete attribute is
set to True, the plugin will be deleted after kusurc executes it.

Take a look at /etc/rc.kusu.d/S02KusuSSHHosts.rc.py for example. On
line 18 you see self.delete = False. If this was set to True, this
plugin would be removed.

HTH
Mike

Loading...