Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Shell Script to modify apachectl
Results 1 to 7 of 7

Thread: Shell Script to modify apachectl

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Shell Script to modify apachectl

    Long time no post..... (I'm back from the depths of OpenBSD-hood and re-embracing my Linux roots)

    Bottom Line... I got a 20 Gig hard drive to dual boot
    Slackware 8.1 and OpenBSD 3.1 AND I go the
    Zaurus SL5500 from Sharp (linux on board)

    Here's my problem...

    Whoever put together the apache-php.ipk for
    the Zaurus left out the apachectl script...

    Several people I have talked to have mentioned
    interest in having this script...

    I have copied the script from my Slackware setup,
    and modified it specifically for the Z...

    Now... The Zaurus has three main areas that any
    program may be installed... RAM filesystem on the
    device, Compact Flash adapter, or Secure Digital
    (SD) Card.

    I am attempting to write an sh script that can be
    run to modify the apachectl variables that are
    needed for it to know where the server and it's
    associated PID files live.

    By default, httpd is located at:
    /home/www/bin/httpd

    and the PID file is located at:
    /home/www/logs/httpd.pid

    Several people (including myself) would rather
    it be installed at:
    /mnt/card/www/bin/httpd
    /mnt/card/www/logs/httpd.pid

    (we basically install to RAM then move the www directory
    to /mnt/card or /mnt/cf depending on whether it's
    an SD or CF)

    I want my script to modify these variables to
    point to wherever the user installed it...

    I am attempting to use sed inside my script and
    am not having much luck.

    There are two problems with the scripts:
    1) When the user inputs a wrong path to
    any of the three file locations asked for,
    it is supposed to exit with an exit status of 1
    (It doesn't.. it just moves on to the next question
    rather than stopping there)

    2) When it gets to the sed statements, it is
    actually trying to open a file and I get this error:
    ./actlsetup: cannot open HTTPD: no such file
    ./actlsetup: cannot open PID: no such file

    Here is a copy of the script:

    #!/bin/sh

    CTL=/usr/local/bin/apachectl
    HTTPD=/home/www/bin/httpd
    PID=/home/www/logs/httpd.pid

    echo "Where is apachectl?"
    echo "Press enter for default path: $CTL"
    echo "or type its full path"

    read ICTL

    if [ -z $ICTL ] ; then
    ICTL=$CTL
    fi

    if [ ! -w $ICTL ] ; then
    echo "$ITCL could not be found"
    exit 1
    fi

    echo "Where is httpd?"
    echo "Press enter for default path: $HTTPD"
    echo "or type its full path"

    read IHTTPD

    if [ -z $IHTTPD ] ; then
    IHTTPD=$HTTPD
    fi

    if [ ! -x $IHTTPD ] ; then
    echo "$IHTTPD could not be found"
    exit 1
    fi

    echo "Where is httpd.pid?"
    echo "Press enter for default path: $PID"
    echo "or type its full path"

    read IPID

    if [ -z $IPID ] ; then
    IPID=$PID
    fi

    if [ ! -r $IPID ] ; then
    echo "$IPID could not be found"
    exit 1
    fi

    `sed s/\#<HTTPD>\n/\#<HTTPD>\n$IHTTPD/g $ICTL`
    `sed s/\#<PID>\n/\#<PID>\n$IPID/g $ICTL`

    echo "Configuration complete."
    echo "Run $ICTL to start, restart,"
    echo "and stop apache"

    #END SCRIPT

    I know that the second problem lies within the
    sed statements as I get different errors if I change
    it a little (by adding \'s in various places hoping it's
    just a special character problem)

    Can anyone here check my scripting and tell me
    why I'm having these problems?

    Thanks...

    gaxprels

    PS... HI Aragorn

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re:Shell Script to modify apachectl

    UPDATE::::

    The first problem was dumb on my part...
    I had /home/www symlinked to /mnt/card/www
    and had my SD inserted (I forgot that I had
    created the symlinks.)

    The script works as expected with regards
    to the first problem.

    I still need to fix my sed commands, though.

    Thanks,

    gaxprels

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re:Shell Script to modify apachectl

    FIXED!!!

    I fixed the sed commands and now it works
    great. I'll post a link here to obtain it for anyone
    interested once I get a license put on it and
    get it posted to the zauruszone forums.

    gaxprels

  4. #4

    Re:Shell Script to modify apachectl

    lol, sorry I didn't see this thread before.

    Long time no see gax, nice to see you around again.

    Aragorn
    If you give a man a fire he'll be warm, if you light the man on fire he'll be warm for life.

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re:Shell Script to modify apachectl

    Thanks... (it's been hectic around here...)

    I am still a computer science student.
    I still have a part time job.
    Now, I have THREE kids, though (instead of two)
    and two months of squalling (and trying to keep
    the two year old from head butting or body slamming
    the two month old) and trying to keep up with
    classes and (Well...... you get the idea)



    Anyway, the youngest is a boy named Shane.
    He was 8 lb 13 oz and 20 1/2 inches long when
    he was born. He's very healthy (complete with
    a bagpipe for lungs!)

    Anyway... I'll try to post in the OpenBSD forum
    here (especially since I originally requested it )
    soon about the many things I have learned about it.

    I'l also try to post here periodically to help some of
    the new guys answer questions and what not.
    (and to ask a few of my own when I get stuck,
    like last night)

    Take care

    gaxprels

  6. #6
    JimH
    Guest

    Re:Shell Script to modify apachectl

    Quote Originally Posted by gaxprels
    FIXED!!!

    gaxprels
    Now thats what I like to see. Problems fixed before I even see them. Saves a lot of work. :

    Jim H

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    304

    Re:Shell Script to modify apachectl

    As I said, anyone who is interested may download my
    scripts from my website:

    http://home.cablelynx.com/~sascjf/index.html

    The site insn't pretty right now, but I'll touch it up (a lot)
    as time permits.

    gaxprels

Similar Threads

  1. Shell script coding
    By lab in forum Programming
    Replies: 0
    Last Post: 07-14-2012, 05:18 AM
  2. Shell script coding
    By lab in forum Programming
    Replies: 0
    Last Post: 07-05-2012, 01:49 PM
  3. Shell script for geoiplookup cmd
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 10-19-2010, 10:18 AM
  4. Need of shell script
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 09-16-2010, 02:34 PM
  5. Shell script for monitoring
    By Hariharan in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 09-16-2010, 05:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •