LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to use vi to do this.... (https://www.linuxquestions.org/questions/linux-general-1/how-to-use-vi-to-do-this-919/)

gretp 02-18-2001 09:56 AM

What I am really trying to do is to create a simple script in the /etc/init.d directory that prints something (like,"Hello, I am your friendly computer.." or "I love you". whatever, it doesn't matter,) the run level, and if the script is starting or stopping something. I want to use vi to create it. But I am not sure whether I should create a directory under /etc/init.d
or...what Should I do? and also, another question is how to us command, ln to create a hard link to the file in /etc/rc2.d and /etc/rc3.d? the last one is how I can bring the system up to run level 3?? Thanks in advance.

devnull 02-18-2001 04:56 PM

you change the runlevel with the "init"-command (you can also use /sbin/telinit, but that's just a link). So, to bring the system into runlevel 3, type init 3 on the console. To make it the default-runlevel, edit your /etc/inittab and change the line with "initdefault...".

Why do you want to create a hardlink? Create a softlink instead! Syntax: ln -s "origin" "link-name"
man ln will give you more details!

The first part of your question confuses me! Maybe my english is to bad.
If you want to do some scripting, create a directory in your home-dir and not in the /etc/init.d-dir.
init.d is a directory for important system-services! Don't play around there!
The current system-runlevel can be shown (depending on your system!) with "runlevel" (as root) or on some systems with "echo $RUNLEVEL".
The echo-command (and also a "HERE-Document" will print out a message.
To see, if the script is starting or stopping something, you have to consider an "if"-statement or "case" (e.g.)

Maybe someone else can help you more.


All times are GMT -5. The time now is 06:35 PM.