Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

(Not exactly a Perl question, but often puzzles unix/linux newbies.)

Two things here. The first one:

how to make a program run as soon as linux is being started

... is usually beeing accomplished by putting the program invocation into the appropriate startup file, most probably (you mentioned "Linux" which one?) the file etc/init.d/boot.local, like mine:

$> cat /etc/init.d/boot.local

starts the cpu temperature sensors package:

#! /bin/sh modprobe w83627hf sleep 1 # optional /usr/bin/sensors -s

the other question was:

how to make my program run atomatically as as soon as somebody log into the linux system

Same thing here, put the command into the appropriate file, for bash login shell, this might be the file ~/.bashrc in your home directory.

For example, you have a program called 'anonymoushydrogen.pl' in your home directory, which contains the following code:

#!/usr/bin/perl print "Hello anonymoushydrogen!\n";

then, you may put the command:

perl ~/anonymoushydrogen.pl

into your .bashrc and all is fine.

But: the exact name of the file may depend on your shell or login configuration (.bashrc, .profile, .bash_profile etc.).

Regards

mwa


In reply to Re: how to make a run a orogram as sooon as linux is being started by mwah
in thread how to run your program when the system is started.... by anonymoushydrogen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-25 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found