htmlq
htmlq copied to clipboard
htmlq does not work with cron
Hello. I have found a bug that happens when I try to use HTMLq with curl in cron job. Same script that works well when run from console, in cron job returns nothing. Empty text. How to reproduce: in python:
import subprocess
command = 'curl --silent https://pwsztar.edu.pl/instytut-politechniczny/informatyka/harmonogramy/ | htmlq "#rozmCZ > p:nth-child(8)"'
ret = subprocess.run(command, capture_output=True, shell=True)
print(ret.stdout.decode('UTF-8'))
in bash script:
#!/bin/bash
variable=$(curl --silent https://pwsztar.edu.pl/instytut-politechniczny/informatyka/harmonogramy/ | htmlq "#rozmCZ > p:nth-child(8)")
echo "$variable"
Does the cronhob have htmlq in PATH?
Usually you use the full paths in cron. Get the full path of htmlq by running command -v htmlq