Re: script bash ruleaza corect de mana si in crontab da syntax error

Adrian Sevcenco <[email protected]>
Newsgroups gmane.org.user-groups.rlug.general
Organization CERN
Message-ID <[email protected]>
On 01/10/2017 03:48 PM, Paul Lacatus (Personal) wrote:
> Hai ca nu mai inteleg nimic . Acest mare script :
>
> root@singureni:~# cat min_process
> #!/bin/bash
> # Publica contor mqtt
> /usr/bin/python /root/mqtt_publish_janitza.py
sunt incepator in python asa ca poate merita pentru altii
sa impartasesc lucruri intelese de mine de curind :

1. daca folosesti un cod de python ca si script de sine statator
(nu intr-un framework) folosesti :
#!/bin/env python
<cod python>

astfel, daca calea e non-standard intru-cat folosesti software 
collections sau un framework care vine cu pythonul propriu
codul va folosi python-ul care trebuie (si poti elimina .py si faci 
scriptul executabil)

2. daca e un framework, si codul e importat, lasi sisierul cu .py
si daca vrei sa il folosesti faci un script separat ca la punctul 1
si faci import la codul principal de unde folosesti ce clase si functii 
vrei ..

Adrian



> # Publica status mqtt
> /usr/bin/python /root/mqtt_publish_pins.py
> # proceseaza alarme e-mail
> /usr/bin/python /root/alarm_proc.py
>
> ruleaza corect de mana ./min_process
>
> dar lansat la minut in crontab da eroarea :
>
> Date: Tue, 10 Jan 2017 15:48:01 +0200 (EET)
> From: Cron Daemon <root@singureni>
> To: root@singureni
> Subject: Cron <root@singureni> /usr/bin/python /root/min_process
>
>    File "/root/min_process", line 3
>      /usr/bin/python /root/mqtt_publish_janitza.py
>      ^
> SyntaxError: invalid syntax
>
>
>
>
>
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.lug.ro/mailman/listinfo/rlug
>


-- 
----------------------------------------------
Adrian Sevcenco, Ph.D.                       |
Institute of Space Science - ISS, Romania    |
adrian.sevcenco at {cern.ch,spacescience.ro} |
----------------------------------------------

_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.