Changeset 478

Show
Ignore:
Timestamp:
05/01/08 14:04:41 (4 months ago)
Author:
ChrisPHL
Message:

possibility to execute user specific commands to every startup (http://trac.freewlan.info/ticket/167)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/etc/init.d/S99rebootcheck

    r437 r478  
    2626echo "`uptime | awk -F" " '{print $1}'`: entering $0" >>/tmp/.startup_log 
    2727 
     28if [ -f /etc/config/startup-commands ]; then 
     29        echo "`uptime | awk -F" " '{print $1}'`: Executing self specified commands for startup now:" >>/tmp/.startup_log 
     30        echo "`cat /etc/config/startup-commands | grep -v "!/bin/sh"`" >>/tmp/.startup_log 
     31        /etc/config/startup-commands 
     32fi 
     33 
    2834( 
    29         while [ -z "$(/usr/bin/wget "http://updates.fon.com/firmware/conncheck/conncheck.txt" -O-)" ]; do 
     35        echo "`uptime | awk -F" " '{print $1}'`: waiting for internet connection..." >>/tmp/.startup_log 
     36                while [ -z "$(/usr/bin/wget "http://updates.fon.com/firmware/conncheck/conncheck.txt" -O-)" ]; do 
    3037                sleep 5 
    3138        done 
     39        echo "`uptime | awk -F" " '{print $1}'`: internet connection detected" >>/tmp/.startup_log 
    3240         
    33         ntpclient -s -h pool.ntp.org 
     41        ntpclient -s -h pool.ntp.org && echo "`uptime | awk -F" " '{print $1}'`: time sync completed" >>/tmp/.startup_log 
    3442         
    3543        . /etc/functions.sh 
  • trunk/www/cgi-bin/webif/diag.sh

    r457 r478  
    9393echo "<input type=\"hidden\" name=\"pin\" value=\"$pin\" />" 
    9494 
     95display_form <<EOF 
     96        infotable|Enter commands to be executed at startup here 
     97EOF 
     98 
     99echo "<textarea name="commandlist" style='width:700px; height:400px'>" 
     100        if empty "$FORM_submit"; then 
     101                [ -f /etc/config/startup-commands ] && echo "`cat /etc/config/startup-commands | grep -v "!/bin/sh"`" 
     102        else 
     103                if [ "$do_not_execute" = "0" ]; then 
     104                        if empty $FORM_commandlist; then 
     105                                rm -f /etc/config/startup-commands 
     106                        else 
     107                                echo "#!/bin/sh" >/etc/config/startup-commands 
     108                                echo "$FORM_commandlist" >>/etc/config/startup-commands 
     109                                chmod 0755 /etc/config/startup-commands >/dev/null 2>&1 
     110                                [ -f /etc/config/startup-commands ] && echo "`cat /etc/config/startup-commands | grep -v "!/bin/sh"`" 
     111                        fi 
     112                else 
     113                        echo "Form seems to be corrupted, no changes were saved for security reasons." 
     114                fi 
     115        fi 
     116echo "</textarea>" 
     117 
     118display_form <<EOF 
     119        start_table|0|10|5 
     120                add_row 
     121                        add_button_cell|submit|@TR<<Submit>> 
     122                end_row 
     123        end_table 
     124EOF 
     125 
    95126footer ?>