LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-10-2015, 05:58 AM   #1
ankit.bajpai14101992
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Rep: Reputation: Disabled
SysVinit Service is not working properly with Arabic Language after reboot


I wrote a program to list down the important files and save them in a file. The files names are in different languages like English, Arabic, Hebrew etc. My program do the task properly but when i create a SysVinit Service and configure it to runlevels, my program doesn't detect the files other than English language after reboot, and it behave unexpectedly, when i restart the service which executes the program, it again detect files with all languages.
Kindly suggest what is the issue here. Becuase it only happens after reboot, when runlevels execute my service. Please let me know if it can be solved or what is the main reason behind it
 
Old 04-10-2015, 10:13 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Can you elaborate? What service you are using/restarting? In which program you want to get it detected?
 
Old 04-13-2015, 08:35 AM   #3
ankit.bajpai14101992
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Initially we started with UPSTART but it failed too then we switch back to Sysvint. The Upstart was not able to list and read the arabic named file but sysvinit solved this issue when service started manually. But again this issue comes when server reboot it doesn't list and read the file. We have tried to check in other way by setting cron to execute service start on reboot and it works fine. From there we conclude it is the problem with service. (FYI : We are not using Ubuntu 15.x version)

Here is the code snippet for sysvinit service


################################################## ##########

#!/bin/bash


CMD='CMD to execute process'
chk_PROC='process name to be checked '
chk_PROC_FIM='dependent process name to be checked '
chk_loop="0"
start() {
PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
PROC_FIM="$(ps -ef | grep $chk_PROC_FIM | grep -v grep | awk '{print $2}' | head -1)"
if [[ -z "$PROC" && -z "$PROC_FIM" ]]; then

echo "Starting PROCESS . . ."
${CMD} &
sleep 1
PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
if [ -z "$PROC" ]; then
if [[ "$chk_loop" -lt "3" ]]; then
start
chk_loop=$((chk_loop+1))
else
echo "unable to start PROCESS"
return
fi
else
echo "PROCESS started, process $PROC."
return
fi
elif [ -z "$PROC" ]; then
kill -9 "$PROC_FIM"
start
else
echo "PROCESS is already running, process $PROC."
return
fi
}

stop() {

PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
PROC_FIM="$(ps -ef | grep $chk_PROC_FIM | grep -v grep | awk '{print $2}' | head -1)"
if [[ -z "$PROC" && -z "$PROC_FIM" ]]; then
echo "PROCESS is already stopped."
return
fi

PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
PROC_FIM="$(ps -ef | grep $chk_PROC_FIM | grep -v grep | awk '{print $2}' | head -1)"
echo "Stopping PROCESS . . ."
if [[ "$PROC" > 0 ]]; then
kill -9 "$PROC"
fi
if [[ "$PROC_FIM" > 0 ]]; then
kill -9 "$PROC_FIM"
fi
sleep 1

PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
PROC_FIM="$(ps -ef | grep $chk_PROC_FIM | grep -v grep | awk '{print $2}' | head -1)"
if [[ -z "$PROC" && -z "$PROC_FIM" ]]; then
echo "PROCESS stopped."
return
else
if [[ "$chk_loop" -lt "3" ]]; then
stop
chk_loop=$((chk_loop+1))
else
echo "unable to stop PROCESS"
exit 1
fi
fi
}

status() {
PROC="$(ps -ef | grep $chk_PROC | grep -v grep | awk '{print $2}' | head -1)"
PROC_FIM="$(ps -ef | grep $chk_PROC_FIM | grep -v grep | awk '{print $2}' | head -1)"
if [ -z "$PROC" ]; then
if [ -z "$PROC_FIM" ]; then
echo "PROCESS stopped."
return
else
echo "PROCESS killed."
return
fi
else
echo "PROCESS running, process $PROC. "
return
fi

}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "*** Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
 
Old 04-13-2015, 08:44 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
It is best to stick with ASCII or Latin not even UTF-8 based filenames for service scripts. grep, awk don't yet support multibyte characters.
 
Old 04-14-2015, 06:21 AM   #5
ankit.bajpai14101992
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Its is being used by a programming language, which is ruby here and the service is used to execute those program files. The program files are able to read those UTF-8 file names, when service are restarted manually, but when after reboot the service starts automatically through SysVinit. The program don't read those file.
 
Old 04-14-2015, 11:51 AM   #6
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
So how do you invoke the ruby program? From command line and from sysvinit?
 
Old 04-16-2015, 02:50 AM   #7
ankit.bajpai14101992
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
The ruby program is running through SysVinit, which uses command line to run the program.
 
Old 04-16-2015, 03:42 AM   #8
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Is the other language files in same directory as english language files?

Does the mount point containing the directory gets mounted before that init script?
 
Old 04-20-2015, 04:04 AM   #9
ankit.bajpai14101992
LQ Newbie
 
Registered: Apr 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes, the other language files, and english files are in same directory. And that directory is on the root partition, ex: /root/<directory>.
 
  


Reply



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
[SOLVED] How to extend the poweroff and reboot process? (without using sysvinit) sanitynotvanity Programming 31 08-18-2009 02:15 PM
How to extend the poweroff and reboot process? (without using sysvinit) sanitynotvanity Linux From Scratch 2 08-13-2009 09:57 AM
Add Arabic language balboul LinuxQuestions.org Member Intro 2 03-22-2008 07:41 PM
adding support for arabic language ximagol Slackware 4 04-26-2006 08:09 AM
vmware not working properly after reboot Hcman Linux - Software 3 10-28-2003 07:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:11 AM.

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
Open Source Consulting | Domain Registration