#444 linux init script dont run

3.1.2
closed
5
2012-08-14
2007-10-12
jef
No

Hi, i tried to build some init script for Linux in Rexx, to debug i use the qdate.rex sample.
i run under Linux 2.6.22.9-0.4-default kernel and rexx : Open Object Rexx Interpreter Version 3.1.2 for LINUX
Build date: Apr 20 2007
I copy the qdate.rexx in /etc/init.d and rename it in testrexx.rex. I build a link in rc3.d : /etc/init.d/rc3.d/S22testrexx -> ../testrexx.rex
I test the S22testrexx that run fine :

obelix:/ # /etc/init.d/rc3.d/S22testrexx

It's Friday the 12th of October, 2007.

There will be a waxing half moon in six days.

obelix:/ #

and try to change run level : telinit 2 and telinit 3. After that i reboot the computer but the script does not run. I changed the rexx to write output, tried some echo, etc .. but init does not seems to run it ?
the Rexx was installed by rpm and the program is in : /opt/ooRexx/bin/rexx with a link in : /usr/bin/rexx that is in the path of init.

Do you know that problem or where i have make a mistake ?
Regards

JFL

Discussion

  • David Ashley

    David Ashley - 2007-10-14

    Logged In: YES
    user_id=931756
    Originator: NO

    Is the /etc/init.d/testrexx.rex file marked executable? Also, init scripts usually have their stdout output sent to the bit bucket. You might want to try sending the output to a file instead. Otherwise you may never see any output.

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-07-08

    JFL This works for me in ooRexx 4.0.0 beta and I don't think this is a bug.

    More like a Linux admin question.

    Here is what I did on Fedora Core 10 32-bit. You need to realize that different Linux systems do this slightly different. So if you are not on Fedora, you will need to adjust where the files and links go.

    As root:

    • Even though the script will run as root, to be sure that there was a place to write to I created a directory /mnt/public and made public writable to everyone:
      chmod o+rwx /mnt/public

    • Create a test script that reads like this:

    !/usr/bin/rexx

    fileName = "/mnt/public/initTest.data"
    f = .stream~new(fileName)

    f~open("write nobuffer")
    f~lineout(date() time())
    f~close

    • cp initTest.rex /etc/rc.d/init.d
    • chmod go+xr /etc/rc.d/init.d/initTest.rex
    • ln -sf /etc/rc.d/init.d/initTest.rex /etc/rc.d/rc3.d/S99initTest.rex

    Reboot and look at the file in /mnt/public. You'll see the date and time for each boot up.

    A couple of notes. The file in /mnt/public will belong to root, so you'll need to be root to read it. S22 is earlish in the boot sequence. While you are just playing around trying to get it to work, I would put it late in the boot sequence. You are not going to see regular 'say' output from your script during the boot sequence. You need to tie into the system logger for that.

    As David said, be sure the file has the executive bit set, be sure the file has the correct permissions.

    Finally, if you can't get it to work, it is not likely that it is an interpreter bug. It is likely you are not setting things up correctly. Asking help from someone familar with Linux administration is your best bet.

    Good luck.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks