Automate Start Script Everytime Linux Turns On

Hi Linux Guru's

I would like to ask on what might be the best move to have our jboss and applications run automatically every time our centos will be turned on.

I'm not yet fully knowledgeable the on how to put the start scripts on chkconfig feature


Similar Content



Chkconfig --add Not Working

Hi friends ,
i am new to linux , i have a script , to auto start/stop a application whenever linux reboot.
when i do chkconfig --add scriptname , it do not add to chkconfig list.
when i do chkconfig --list scriptname , it gives me info , "service chkconfig enabled , please add by running command chkconfig --add scriptname."

OS is Redhat 6.3
i had tested on another server redhat 6.5 , it is working fine on it.

Thanks in advance

Need To Remove In Logging

Hi Linux Guru's

I made a logging on my restart script for jboss but I keep on getting these characters Quote:
ESC[60G[ESC[0;32mESC[0;39m]
like the logging shows below:

Quote:
Apr 30 11:32:20 pogiako JBOSS IS RUNNING (JBOSS7_PID: 1234)
Stopping poging-jboss-as: ..............ESC[60G[ESC[0;32m OK ESC[0;39m]
The above result should only shows "[OK]" I remember I made some colorization on the logging but later on I reverted it back. I already looked at my script and found no more traces of colorization tags.please help

First Time After Install, Run Configuration Script

Hello,

My job is having me get back into Linux. It has been awhile since I messed with it. My company releases Software that runs on Linux. As such, when we release a new version of the software, we have it packaged with the entire Linux OS. As such, when it is sent to our clients, they install, and then have to reconfigure, the Host Name, IP Address, Netmask, and Gateway. Our test environment consists of over ten different Linux boxes and configurations. To make life easier for me, I have written a shell script allowing me a menu to change all of these and to also enable or disable the gateway and how to set/change the localadm password.

I want the script available to users to be able to run it anytime they need to. It works great. I would like to add one more thing to this. I want to be able to run the script automatically on the very first boot after the installation. The script is set up where you have to log in as root to run it. So here is the process I want to happen:

Install Disk
System starts up for very first time after install
Automatically logs in as root and runs script
Exits as root.

I realize Linux will only do what I tell it to. How do I tell it to do this?

Jboss7 Giving 2 PID's

Hi Linux Guru's

We have a running jboss7 app from our servers, I am just wondering although our dev people has a strong stop-start jboss script, we still got an output of two PID's after the start of jboss7. So we just assumed the old PID becomes on stale state but we are still not sure. May I know is there anyone encounter this same situataion? Does the "what-we-so-called stale PID" still eat memory resources of the server?


[pogi@gorgeous_server log]$ ps -ef | grep standalone
pogi 10664 6724 0 22:27 pts/1 00:00:00 grep standalone
pogi 14114 1 0 Mar10 ? 00:00:00 /bin/sh /opt/pogi/pkg/jboss-pogi/bin/standalone.sh -c=standalone.xml -b=0.0.0.0
pogi 14207 14114 99 Mar10 ? 4-21:59:53 /opt/pogi/pkg/sunjdk6_25/bin/java -D[Standalone] -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms12G -Xmx12G -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/pogi/log -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Djava.io.tmpdir=/opt/pogi/.cache -Xloggc:/opt/pogi/log/gc.log -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Dorg.jboss.boot.log.file=/opt/pogi/pkg/jboss-pogi/standalone/log/boot.log -Dlogging.configuration=file:/opt/pogi/pkg/jboss-pogi/standalone/configuration/logging.properties -jar /opt/pogi/pogi/jboss-pogi/jboss-modules.jar -mp /opt/pogi/pkg/jboss-pogi/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/pogi/pkg/jboss-pogi -c=standalone.xml -b=0.0.0.0
pogi 10664 6724 0 22:27 pts/1 00:00:00 grep standalone
pogi 14344 1 0 Mar8 ? 00:00:00 /bin/sh /opt/pogi/pkg/jboss-pogi/bin/standalone.sh -c=standalone.xml -b=0.0.0.0
pogi 23421 14114 99 Mar8 ? 4-21:59:53 /opt/pogi/pkg/sunjdk6_25/bin/java -D[Standalone] -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms12G -Xmx12G -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/pogi/log -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Djava.io.tmpdir=/opt/pogi/.cache -Xloggc:/opt/pogi/log/gc.log -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -Dorg.jboss.boot.log.file=/opt/pogi/pkg/jboss-pogi/standalone/log/boot.log -Dlogging.configuration=file:/opt/pogi/pkg/jboss-pogi/standalone/configuration/logging.properties -jar /opt/pogi/pogi/jboss-pogi/jboss-modules.jar -mp /opt/pogi/pkg/jboss-pogi/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/pogi/pkg/jboss-pogi -c=standalone.xml -b=0.0.0.0

Script Help To Shutdown And Start

Dear Friends,

I am new to scripting. I want a help on script to schedule the shutdown and start up . I am using SUSE Linux system. Can some one guide me please

every night shutdown at 7pm & start it at 7am the next day during the weekdays. On the weekends, the server only needs to restart at 7am on Mondays.

Looking forward for help

Thank you

Regards

pearl

How To Master Linux? Where Do I Start?

I'm new to Linux, I want to master all of the lovely little details about what makes Linux tick, and how it ticks. I would love to know any suggestions of where I should start. I want to know how anything, the hardware, software, and firmware works. I am wanting to get into computer science, I'm very motivated and am willing to put in the time to learn and master Linux. I figure that Linux is a good of a place to start as any, seeing how there is a lot of source code to study and open source software to play around with.

Automatically Starting A Python Script On Startup After Reboot...

I am running a headless Linux 17 media/NAS server. I have setup and tested the plexconnect script and it works. My only issue is that I can't figure out how to get the script to automatically run on startup. I tried using the GUI, but it doesn't seem to work.

To get it to work, I have to open terminal and navigate to the directory:

/usr/local/lib/PlexConnect/

Then run: sudo ./PlexConnect.py

The window has to remain open in order to keep running (which isn't an issue as it's headless). I'd just like to not have to login and start it each time the power goes out, or is rebooted.

I tried editing the crontab file and adding the following variations with no luck:
@reboot python /usr/local/lib/PlexConnect/PlexConnect.py
@reboot /usr/local/lib/PlexConnect/PlexConnect.py

Neither has worked. Does anyone know what I'm doing wrong?

Thanks!

GRUB2 Scripts To Use Labels For Friendly Names

I am using linux mint and the grub menu gets configured automatically using scripts in /etc/grub.d. The menuentry that gets created is something like Code:
"linux mint (on /dev/sda1)"

. I use external drives sometimes and also have linux on my harddrive which I also switch between computers. It gets confusing when it says /dev/sda2 when it means something else. It boots fine because that actual boot command uses uuid. How can I change the text of the (script generated) description to also use partition labels or uuid (or the first few chars) just so I know which install will actually boot. like this: Code:
"Linux Mint (OFFICESSD)"
"Linux Mint (HOMEHDD)"
"Ubuntu (SANDISK)"
"Ubuntu (IMATION)"

I realise (maybe its the best way) I can change the "GRUB_TITLE=Linux Mint 17 Cinnamon 64-bit" in /etc/linuxmint/info but would rather a smoother way.

Using Awk Print

Hi Linux Guru's

need some a little help regarding on the jboss command that will validate. The command should only echo either "jboss7" or "jboss4"


however in our jboss7 we got also jboss7modules running and it should not be there from the output

[pogi.ako@server2 ~]$ rpm -qa | grep jboss | grep -v config | awk -F'-' '{print $3}'
jboss7
jbossmodules


using with |tail -1 | head -1
[lemuel.luna@server2 ~]$ rpm -qa | grep jboss | grep -v config | awk -F'-' '{print $3}' |tail -1 | head -1
jbossmodules


but from other servers I see it has different approach

[pogi.ako@server1 bin]$ rpm -qa | grep jboss | grep -v config | awk -F'-' '{print $3}'
jbossmodules
jboss7


[pogi.ako@server1 bin]$ rpm -qa | grep jboss | grep -v config | awk -F'-' '{print $3}' |tail -1 | head -1
jboss7


I'm trying to achieve here on on not to include jbossmodules from the output

Best Way To Run Two Interdependent Scripts

Hi All,

I have two scripts, the aim of these two scripts is, to check whether a particular script is running or not, if it wont runs, then throw a mail.

How i Achieved this output is, I wrote first script.

I created an infinite while loop which performs below steps

1. It creates a touch file
2. Triggers the script which needs to be monitored if its working or not.
3. Removes the touch file.

If the second step fails, then the remove file command will not happen and the script will stuck there itself.

I created an another script which checks the creation time of the touch file and if it is more than ten minutes, it means the second step in the first script is hanged, which also means that particular script is not working.

So if the creation time is more than 2 minutes the second script will throw a mail.

Below are the two scripts.

Code:
#!/bin/ksh



userid="chansd"

filename="/apps/log/check.txt"

while true ;do
touch $filename
pass=`/apps/eDMZ/call_st.ksh $userid`
sleep 20
rm $filename
done

Below script checks the file creation time and throws email if it is older than 2 minutes
Code:
#!/bin/ksh


filename="/apps/log/check.txt"

if [ -f "${filename}" ]
then
if test "`find $filename -mmin +2`"
then
echo "script is not working ! Please act on it" | mail -s "Script  is not working" Example@mail.com
fi


else

        exit 1

fi


What im going to do is

1. I am going to run the first script in background so it runs forever.
2. I am going to run the second script in cron forevry 5 mins to check the file creation time.

3. So if the first script hangs . I will kill the process using process id and after the issue resolves with the inner script, I will run the main script again.

I am new to Linux, Please let me know if this approach will work as expected.