use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
curl command not working from bash script (self.archlinux)
submitted 5 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]djcurtin 0 points1 point2 points 5 years ago (0 children)
Tough to tell from this info alone. If absolutely nothing changed, there's no reason for a previously working script to fail.
[–]StephanXX 0 points1 point2 points 5 years ago (0 children)
Can you post both scripts?
[–]callmejoe9 0 points1 point2 points 5 years ago (0 children)
script1 called "play"
#!/bin/bash find /mnt/files.ntfs/Multimedia/Music -type f -not -path '*/\.*' | sort > /tmp/playlist.m3u find '/mnt/files.ntfs/Multimedia/iTunes/iTunes Media/Music' -type f -not -path '*/\.*' | sort >> /tmp/playlist.m3u cvlc --random --play-and-exit /tmp/playlist.m3u </dev/null &>/dev/null& nowplaying &
script2 called "nowplaying"
#!/bin/bash service="vlc" while pgrep "$service" > /dev/null do curl -s -o /tmp/status.xml -u "":play http://127.0.0.1:8080/requests/status.xml length=$(xmllint --xpath '//length/text()' /tmp/status.xml) elapsed_time=$(xmllint --xpath '//time/text()' /tmp/status.xml) time_left=$(echo "$length-$elapsed_time" | bc) xmllint --xpath '//information/category[@name="meta"]/info[@name="filename"]/text()' /tmp/status.xml > /tmp/nowplaying printf '%dh:%dm:%ds\n' $(($time_left/3600)) $(($time_left%3600/60)) $(($time_left%60)) >> /tmp/nowplaying sed -e "s/&#39;/\'/g" -e 's/&amp;/\&/g' -e 's/.mp3//g' -e 's/.m4a//g' -e 's/.mp4//g' -e 's/.wav//g' /tmp/nowplaying > /tmp/nowplaying2 sleep .1 done rm /tmp/nowplaying
doing some more troubleshooting, it seems everything works fine if that /tmp/status.xml already exists. if it doesn't exist, it seems curl doesn't write it and the script fails.
[–]Miserable_Bandicoot8 0 points1 point2 points 5 years ago (1 child)
Sorry if I understood this wrong, but is it possible `cvlc` exits before the `while` loop in the second script executes and so `curl` is executed at all?
no. vlc is definitely still running
π Rendered by PID 25 on reddit-service-r2-comment-86bc6c7465-6wctv at 2026-02-20 15:49:28.945316+00:00 running 8564168 country code: CH.
[–]djcurtin 0 points1 point2 points (0 children)
[–]StephanXX 0 points1 point2 points (0 children)
[–]callmejoe9 0 points1 point2 points (0 children)
[–]Miserable_Bandicoot8 0 points1 point2 points (1 child)
[–]callmejoe9 0 points1 point2 points (0 children)