LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2010, 08:46 PM   #16
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Arrow


Quote:
Originally Posted by schneidz View Post
edit: also are you in the us ?
where did you get your n900/ how much ?
what cell company do you have ?
is it gsm and cdma or just gsm ?

thanks,
I am currently in Australia but I have imported it from the US.
I bought it at Amazon for 549$.
It works here in Australia with Virgin Mobile on 3G and it should do the same with T-Mobile, Verizon and Sprint (no AT&T) in the US but I am not completely sure about Verizon and Sprint.


I will try to use pgrep -x for the kill command as well but I am not sure what will happen if there is someone connected and because of this there are multiple processes of proftpd running.
 
Old 01-07-2010, 08:53 PM   #17
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by dEM0nsTAr View Post
I will try to use pgrep -x for the kill command as well but I am not sure what will happen if there is someone connected and because of this there are multiple processes of proftpd running.
Do you already have plans on how you can properly implement this? Tip: You can record the PID from $! to a file whenever you execute proftpd.
 
Old 01-07-2010, 09:17 PM   #18
dEM0nsTAr
LQ Newbie
 
Registered: Nov 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Maybe I should use this script instead for init.d
Code:
  #!/bin/sh

  # ProFTPD files
  FTPD_BIN=/opt/sbin/proftpd
  FTPD_CONF=/opt/etc/proftpd.conf
  PIDFILE=/var/run/proftpd.pid

  # If PIDFILE exists, does it point to a proftpd process?

  if [ -f $PIDFILE ]; then
   pid=`cat $PIDFILE`
  fi

  if [ ! -x $FTPD_BIN ]; then
    echo "$0: $FTPD_BIN: cannot execute"
    exit 1
  fi

  case $1 in

    start)
      if [ -n "$pid" ]; then
        echo "$0: proftpd [PID $pid] already running"
        exit
      fi

      if [ -r $FTPD_CONF ]; then
        echo "Starting proftpd..."

        $FTPD_BIN -c $FTPD_CONF
	 ps -ef | pgrep -x proftpd | awk 'NR>1{exit};1' > $PIDFILE

      else
        echo "$0: cannot start proftpd -- $FTPD_CONF missing"
      fi
      ;;

    stop)
      if [ -n "$pid" ]; then
        echo "Stopping proftpd..."
	 rm $PIDFILE
        kill -TERM $pid

      else
        echo "$0: proftpd not running"
        exit 1
      fi
      ;;

    restart)
      if [ -n "$pid" ]; then
        echo "Rehashing proftpd configuration"
        kill -HUP $pid

      else
        echo "$0: proftpd not running"
        exit 1
      fi
      ;;

    *)
      echo "usage: $0 {start|stop|restart}"
      exit 1
      ;;

  esac

  exit 0
Looks better and should work in Busybox. Will try it at home. Thanks all for your support!

Last edited by dEM0nsTAr; 01-08-2010 at 01:20 AM.
 
  


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
bash: daemon: command not found linx win Fedora 3 02-16-2016 01:43 AM
bash script running as daemon Satriani Programming 12 03-29-2011 05:23 PM
Run my bash script as a daemon. jaimese Linux - Newbie 12 02-10-2011 03:28 PM
[SOLVED] Help with simple script to toggle gamma values on lcd monitor musonio Linux - Software 14 09-25-2009 12:44 AM
Bash script to verify the daemon is working if not, start the daemon kishoreru Linux - Newbie 7 09-23-2009 04:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:28 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
Open Source Consulting | Domain Registration