Find the answer to your Linux question:
Results 1 to 4 of 4
I'm currently trying to execute scripts in terminal as root, when i attempt to run them the system generally requires me to use Code: su root ./file.sh after changing permissions ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    3

    Newbie Scripting Help

    I'm currently trying to execute scripts in terminal as root, when i attempt to run them the system generally requires me to use

    Code:
    su root ./file.sh
    after changing permissions on file.sh it allows me to execute the script by simply typing:

    Code:
    ./file.sh
    however now, the script proceeds to run another script from within the same directory. File.sh looks like this

    Code:
    #!/bin/sh
    
    ./file_loop.sh
    the console executes ./file.sh but when attempting to execute ./file_loop.sh it tells me
    Code:
    ./file.sh: line 3: ./file_loop.sh: Permission denied
    Please help!

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    Is file_loop.sh executable?

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    3
    i just set the file to "allow executing as a program" but ls -l doesn't show it as -x

  4. #4
    Just Joined!
    Join Date
    Mar 2008
    Posts
    3
    okay, here's the exact scripts. at this point i don't really mind people seeing it.

    startGameServer.sh

    Code:
    #!/bin/sh
    
    ./GameServer_loop.sh
    GameServer_loop.sh

    Code:
    #!/bin/bash
    
    # exit codes of GameServer:
    #  0 normal shutdown
    #  2 reboot attempt
    
    while :; do
    	[ -f /L2J/gameserver/log/java0.log.0 ] && mv log/java0.log.0 "log/`date +%Y-%m-%d_%H-%M-%S`_java.log"
    	[ -f log/stdout.log ] && mv log/stdout.log "log/`date +%Y-%m-%d_%H-%M-%S`_stdout.log"
    	java -Xms768m -Xmx768m -cp ./../libs/*:l2jserver.jar net.sf.l2j.gameserver.GameServer > log/stdout.log 2>&1
    	[ $? -ne 2 ] && break
    #	/etc/init.d/mysql restart
    	sleep 10
    done
    the scripts are supposed to start a L2J emulated server

Posting Permissions

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