Creating Python Cron Job On Synology: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:NASCategory:SynologyCategory:Python == Objective == To install a python script on Synology NAS and run it as a cron job. == Prerequisites == === python...") |
m (→pip) |
||
| Line 15: | Line 15: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ sudo curl -k https://bootstrap.pypa.io/get-pip.py | | $ sudo curl -k https://bootstrap.pypa.io/get-pip.py | python3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:04, 31 March 2018
Objective
To install a python script on Synology NAS and run it as a cron job.
Prerequisites
python
Install Python3 using the Package Center app in the DSM.
pip
SSH to the DiskStation and install pip with
$ sudo curl -k https://bootstrap.pypa.io/get-pip.py | python3
This will install pip at /volume1/@appstore/py3k/usr/local/bin/, but the pip command isn't automatically available.
$ sudo ln -s /volume1/@appstore/py3k/usr/local/bin/pip /usr/local/bin/pip
virtualenv
Once pip is installed, use it to install virtualenv, and make sure the command is available from the command line:
$ sudo pip install virtualenv $ sudo ln -s /volume1/@appstore/py3k/usr/local/bin/virtualenv /usr/local/bin/virtualenv
Create a virtual environment for the python script:
$ virtualenv -p /volume1/@appstore/py3k/usr/local/bin/python3 venv