Script não está sendo executado no currículo / ativação no Ubuntu

0

Eu tenho um script chamado 999_thaw_flash.sh no meu /etc/pm/sleep.d

O script segue assim: -

export DISPLAY=:0
#!/bin/bash
case "{$1}" in
    resume|thaw)
lynx --dump link1 >> file1
lynx --dump link2 >> file1
lynx --dump link3 >> file1

grep "magnet:?xt=urn:btih:" file1 > file2

sed -i 's/^......//' file2

awk '/org%3A1337%2Fannounce/{print;print "";next}1' file2 >> file3

lines=$(wc -l < file3)

echo "no. of line $lines"
    if grep silicon+valley+s03e03+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e03+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
                notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 3'
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush

    fi

    if grep silicon+valley+s03e05+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e05+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
                notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 5'
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi

    if grep silicon+valley+s03e06+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e06+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
            notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 6'
            echo episode 6 of silicon valley online
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi
    if grep silicon+valley+s03e07+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e07+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
            notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 7'
            echo episode 7 of silicon valley online
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi
    if grep silicon+valley+s03e08+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e08+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
            notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 8'
            echo episode 8 of silicon valley online
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi
    if grep silicon+valley+s03e09+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e09+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $
            notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 9'
            echo episode 9 of silicon valley online
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi
    if grep silicon+valley+s03e10+720p+hdtv+x265+hevc+ file3;
        then
            lineno=$(grep -n silicon+valley+s03e10+720p+hdtv+x265+hevc+ file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
            notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting silicon valley episode 10'
            echo episode 10 of silicon valley online
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush
    fi
    ;;
esac    

Espero que a sintaxe esteja correta e que o posicionamento do script esteja na pasta correta.

O script não é executado no resumo do sistema.

Onde estou indo errado?

Eu tentei: - Executar scripts no Wakeup?

como executar um comando após o reinício da suspensão?

Como executar um script após o sistema sair do modo de hibernação (suspenso para o disco)?

Como executar um script ao suspender / retomar? - Sony VAIO Ubuntu 12.04

link

link

Mas ninguém parece me ajudar.

P.S. O script é executado bem no terminal.

Os logs: -

May 22 20:39:16 user-550p5c-550p7c systemd-sleep[19426]: /lib/systemd/system-sleep/flush failed with error code 1.
May 22 20:39:16 user-550p5c-550p7c systemd-sleep[19426]: /lib/systemd/system-sleep/Flash.ico failed with error code 1.
May 22 20:39:16 user-550p5c-550p7c systemd-sleep[19426]: /lib/systemd/system-sleep/file3 failed with error code 1.
May 22 20:39:16 user-550p5c-550p7c systemd-sleep[19424]: Failed to connect to non-global ctrl_ifname: (nil)  error: No such file or directory
May 22 20:39:16 user-550p5c-550p7c systemd-sleep[19424]: Suspending system...
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19424]: System resumed.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19424]: Failed to connect to non-global ctrl_ifname: (nil)  error: No such file or directory
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/wpasupplicant failed with error code 255.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/Flash.ico failed with error code 1.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/file3 failed with error code 1.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/file1 failed with error code 1.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/file2 failed with error code 1.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/999_thaw_flash.sh failed with error code 1.
May 22 20:39:23 user-550p5c-550p7c systemd-sleep[19459]: /lib/systemd/system-sleep/flush failed with error code 1.
May 22 20:39:25 user-550p5c-550p7c systemd-sleep[19424]: /dev/sda:
May 22 20:39:25 user-550p5c-550p7c systemd-sleep[19424]:  setting Advanced Power Management level to 0xfe (254)
May 22 20:39:25 user-550p5c-550p7c systemd-sleep[19424]:  APM_level        = 254
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Looking up kat.cr
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Unable to locate remote host kat.cr.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Alert!: Unable to connect to remote host.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: lynx: Can't access startfile https://kat.cr/usearch/the%20flash/
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Looking up kat.cr
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Unable to locate remote host kat.cr.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Alert!: Unable to connect to remote host.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: lynx: Can't access startfile https://kat.cr/usearch/gotham/
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Looking up kat.cr
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Unable to locate remote host kat.cr.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: Alert!: Unable to connect to remote host.
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: lynx: Can't access startfile https://kat.cr/usearch/silicon%20valley/
May 22 20:39:30 user-550p5c-550p7c systemd-sleep[19424]: no. of line 0
    
por penta 22.05.2016 / 16:13

1 resposta

0

Como systemd , o local adequado para isso é /lib/systemd/system-sleep . Faça lá um arquivo, por exemplo. 999_thaw_flash e cole assim:

#!/bin/sh

case $1/$2 in
    post/suspend)
        your_srcipt_here ....
    ;;
esac
    
por EdiD 22.05.2016 / 16:35