(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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.