| 1 | == Antenna Setup/Installation/Deployment Validation == |
| 2 | |
| 3 | Attahc E312 to the large sector antennas to test cabling; cover GPS and each of the pannel antennas. |
| 4 | |
| 5 | |
| 6 | E312 + cabling + USB flash drive + directional antenna for SA + portable SA |
| 7 | |
| 8 | Run two utilities: |
| 9 | |
| 10 | * gpspipe |
| 11 | * tx_waveform |
| 12 | |
| 13 | === Start stop cadv script === |
| 14 | |
| 15 | {{{ |
| 16 | #!/bin/sh |
| 17 | |
| 18 | ### BEGIN INIT INFO |
| 19 | # Provides: cadv |
| 20 | # Required-Start: $remote_fs $network gpsd |
| 21 | # Required-Stop: $remote_fs $network |
| 22 | # Default-Start: 2 3 4 5 |
| 23 | # Default-Stop: 0 1 6 |
| 24 | # Short-Description: COSMOS Antenna Deployment Validation start/stop script |
| 25 | # Description: Start/Stop script for the COSMOS service daemon, |
| 26 | # which start logging the GPS coordinates and starts |
| 27 | # the transmitter on channel 1 so it can verify the antenna |
| 28 | # cabling functionality |
| 29 | ### END INIT INFO |
| 30 | |
| 31 | # Author: WINLAB COSMOS Team |
| 32 | |
| 33 | # PATH should only include /usr/* if it runs after the mountnfs.sh script |
| 34 | # PATH=/sbin:/usr/sbin:/bin:/usr/bin |
| 35 | DESC="COSMOS Antenna Deplotment Validation" |
| 36 | NAME=cadv |
| 37 | SCRIPTNAME=/etc/init.d/$NAME |
| 38 | LOGDIR=/mnt |
| 39 | LOGFILE="$LOGDIR/$NAME-$(date -u +"%FT%H%MZ").log" |
| 40 | TXFREQ="2440.0e6" |
| 41 | TXRATE="4e6" |
| 42 | TXWAVE="RAMP" |
| 43 | TXWAVEFREQ="1e6" |
| 44 | TXGAIN="100" |
| 45 | PROG1=/usr/bin/gpspipe |
| 46 | PROG2=/usr/lib/uhd/examples/tx_waveforms |
| 47 | |
| 48 | PROG1BASE=`basename $PROG1` |
| 49 | PROG2BASE=`basename $PROG2` |
| 50 | |
| 51 | # Read configuration, if present |
| 52 | [ -r /etc/init.d/functions ] && . /etc/init.d/functions |
| 53 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME |
| 54 | |
| 55 | # |
| 56 | # Check for external storage |
| 57 | # |
| 58 | # |
| 59 | # Function that starts the services |
| 60 | # |
| 61 | do_start() |
| 62 | { |
| 63 | echo -n "Mount storage drive..." |
| 64 | mount /dev/sda1 /mnt |
| 65 | echo " OK" |
| 66 | echo -n "Starting $PROG1: " |
| 67 | $PROG1 -d -r -t -o "$LOGFILE" |
| 68 | RETVAL=$? |
| 69 | if [ "$RETVAL" = 0 ] ; then |
| 70 | echo "OK" |
| 71 | touch /var/lock/subsys/$PROG1BASE |
| 72 | else |
| 73 | echo "FAIL" |
| 74 | fi |
| 75 | echo -n "Starting $PROG2: " |
| 76 | $PROG2 --freq "$TXFREQ" --rate "$TXRATE" --gain "$TXGAIN" --wave-type "$TXWAVE" --wave-freq "$TXWAVEFREQ" >> "$LOGFILE" 2>&1 & |
| 77 | RETVAL=$? |
| 78 | if [ "$RETVAL" = 0 ] ; then |
| 79 | echo "OK" |
| 80 | touch /var/lock/subsys/$PROG2BASE |
| 81 | else |
| 82 | echo "FAIL" |
| 83 | fi |
| 84 | |
| 85 | } |
| 86 | |
| 87 | # |
| 88 | # Function that stops the services |
| 89 | # |
| 90 | do_stop() |
| 91 | { |
| 92 | echo -n "Stopping $PROG1: " |
| 93 | killproc $PROG1 >& /dev/null |
| 94 | rm -f /var/lock/subsys/$PROG1 |
| 95 | if [ -n "`/bin/pidof $PROG1`" ] ; then |
| 96 | echo "FAIL" |
| 97 | else |
| 98 | echo "OK" |
| 99 | fi |
| 100 | echo -n "Stopping $PROG2: " |
| 101 | killproc $PROG2 >& /dev/null |
| 102 | rm -f /var/lock/subsys/$PROG2 |
| 103 | if [ -n "`/bin/pidof $PROG2`" ] ; then |
| 104 | echo "FAIL" |
| 105 | else |
| 106 | echo "OK" |
| 107 | fi |
| 108 | umount /mnt |
| 109 | } |
| 110 | |
| 111 | case "$1" in |
| 112 | start) |
| 113 | echo "Starting $DESC" "$NAME" |
| 114 | do_start |
| 115 | exit $? |
| 116 | ;; |
| 117 | stop) |
| 118 | echo "Stopping $DESC" "$NAME" |
| 119 | do_stop |
| 120 | exit $? |
| 121 | ;; |
| 122 | restart) |
| 123 | # |
| 124 | # If the "reload" option is implemented then remove the |
| 125 | # 'force-reload' alias |
| 126 | # |
| 127 | echo "Restarting $DESC" "$NAME" |
| 128 | do_stop |
| 129 | case "$?" in |
| 130 | 0|1) |
| 131 | do_start |
| 132 | exit $? |
| 133 | ;; |
| 134 | *) |
| 135 | # Failed to stop |
| 136 | exit 1 |
| 137 | ;; |
| 138 | esac |
| 139 | ;; |
| 140 | *) |
| 141 | echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2 |
| 142 | exit 3 |
| 143 | ;; |
| 144 | esac |
| 145 | |
| 146 | : |
| 147 | }}} |
| 148 | |
| 149 | |
| 150 | Install as startup script with: |
| 151 | {{{ |
| 152 | update-rc.d cadv defaults 99 |
| 153 | }}} |
| 154 | |
| 155 | Output if antenna is working fine: |
| 156 | |
| 157 | [[Image(sa-output.png, width=200)]] |
| 158 | |
| 159 | Transition from all 0 to GPS coorinates in teh log file on the flash drive (filename based turn-on timestamp) |
| 160 | |