LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2013, 01:44 AM   #1
ashok.565656
LQ Newbie
 
Registered: Dec 2013
Posts: 2

Rep: Reputation: Disabled
Services in Linux using .sh file


Hi Everyone,

I created a run.sh file to run executable jar in Linux.it will working fine.Now i need to this run.sh file run as services.So i created a script as follows,

Code:
#!/bin/sh
. /etc/rc.status
rc_reset
case "$1" in
    start)
	echo -n "Trigger the Report"
	startproc /usr/Trigger/run.sh
	
 
	rc_status -v
	;;
esac
rc_exit
and I named it as rc.TcStart.Then i run in terminal as,

Code:
service rc.TcStart start
then i got the below error.

Code:
service rc.TcStart start
Trigger the reportstartproc:  cannot execute /usr/Trigger/run.sh: Exec format error
Please tell anyone how to solve this or how can i create service for jar file.

Thanks,

Ashok

Last edited by ashok.565656; 12-19-2013 at 01:46 AM.
 
Old 12-19-2013, 01:52 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,767

Rep: Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886
I think startproc can only execute binaries, shell scripts cannot be started.
 
Old 12-19-2013, 01:54 AM   #3
ashok.565656
LQ Newbie
 
Registered: Dec 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Then how can i run sh file as service.please tell me how to do it.

Thanks,
Ashok
 
Old 12-19-2013, 01:59 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,767

Rep: Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886Reputation: 2886
you can convert any shell script to binary. It is called shc.
http://www.thegeekstuff.com/2012/05/...-shell-script/
 
Old 12-19-2013, 11:24 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,711

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
I think the shell script just needs to be marked executable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Learn Linux, 302 (Mixed environments): File services LXer Syndicated Linux News 0 05-26-2011 08:30 AM
Linux Server and Linux Clients Networking. File sharing services. Remote home folder admitrievsky Linux - Server 5 01-28-2008 02:23 PM
LXer: Linux File Services: Good Things Arrive in Fours LXer Syndicated Linux News 0 01-03-2007 09:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration