|    RBERRYPI    |    Support for the Raspberry Pi device    |    21,939 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 21,154 of 21,939    |
|    DrStevenStrange to All    |
|    AI Written Bash Script    |
|    12 Dec 24 12:43:14    |
   
   INTL 3:770/1 3:770/3   
   REPLYADDR kubmw2ce@duck.com   
   REPLYTO 3:770/3.0 UUCP   
   MSGID: 5360cbe7   
   PID: SoupGate-Win32 v1.05   
   Ok - don't laugh   
      
   My coding skills are pitiful so I asked my resident Ai to write a bash   
   script to call a webcam script (I did write this one) only between   
   sunrise and sunset. it produced this and it works! My question is - how   
   can I amend the script so it starts 30 minutes BEFORE sunrise and stops   
   30 Minutes after?   
      
   #!/bin/bash   
      
   # Set your latitude and longitude   
   LATITUDE="mine"   
   LONGITUDE="mine"   
      
   # Fetch sunrise and sunset times in UTC   
   SUN_TIMES=$(curl -s   
   "https://api.sunrise-sunset.org/json?lat=$LATITUDE&lng=$LONGITUDE&formatted=0")   
   SUNRISE=$(echo $SUN_TIMES | jq -r '.results.sunrise')   
   SUNSET=$(echo $SUN_TIMES | jq -r '.results.sunset')   
      
   # Convert sunrise and sunset times to seconds since epoch   
   SUNRISE_EPOCH=$(date -d "$SUNRISE" +%s)   
   SUNSET_EPOCH=$(date -d "$SUNSET" +%s)   
   CURRENT_EPOCH=$(date +%s)   
      
   # Check if the current time is between sunrise and sunset   
   if [ $CURRENT_EPOCH -ge $SUNRISE_EPOCH ] && [ $CURRENT_EPOCH -le   
   $SUNSET_EPOCH ]; then   
    echo "It's between sunrise and sunset. Running the other script..."   
    # Call the other script   
    ./webcam.sh # Replace with the path to your script   
   else   
    echo "It's not between sunrise and sunset."   
   fi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)   
   SEEN-BY: 4/0 19/10 88/0 90/0 105/81 106/201 128/187 129/305 153/757   
   SEEN-BY: 153/7715 218/700 840 220/70 221/1 6 360 226/17 30 100 227/114   
   SEEN-BY: 229/110 111 114 200 206 300 317 400 426 428 550 616 664 700   
   SEEN-BY: 229/705 266/512 267/800 282/1038 291/111 292/854 301/1 310/31   
   SEEN-BY: 320/219 322/757 335/364 341/66 342/200 396/45 460/58 633/280   
   SEEN-BY: 712/848 770/1 3 100 330 340 772/210 220 230 880/1 900/0 102   
   SEEN-BY: 900/106 902/0 6 19 26 905/0 930/1 5020/400 5075/35   
   PATH: 770/3 1 218/840 221/6 341/66 902/26 229/426   
      
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca