-
Manually create the
campusenergyuser on the server (only needed for first-time setup). -
Switch to the
campusenergyuser.su campusenergy
-
Go to the
campusenergyhome directory.cd /home/campusenergy -
Ensure there is a
.pgpassfile set up in the home directory of the user that will run the cron job. Verify that it has the correct permissions.Create the
.pgpassfile if it doesn't exist.touch ~/.pgpassEdit the
.pgpassfile to add your database credentials.nano ~/.pgpassAdd the following line (replace with your actual credentials):
localhost:5432:uhm2023:campusenergy:your_passwordSet the correct permissions.
chmod 600 ~/.pgpass -
Clone the
communicator-projectrepository.git clone https://github.com/Campus-Energy/communicator-project.git
-
Create a folder in the home directory named
inbox; files pending data extraction and upload should be placed here.mkdir inbox
-
cdinto the repository folder.cd communicator-project -
Install python3 packages from
requirements.txt.sudo pip3 install -r requirements.txt
-
Run
init_crontab.py.python3 /home/campusenergy/communicator-project/init_crontab.py <interval - minute, hourly, daily, weekly, or monthly> /home/campusenergy/communicator-project/db_upload.py /home/campusenergy/logs/db_upload.log
-
Check the log file to verify script execution.
cd .. cat db_upload.log -
To remove the cron job, open the crontab file and delete the line with the existing cron job:
crontab -e
The job will look something like this:
* * * * * /usr/bin/python3 /home/campusenergy/communicator-project/db_upload.py >> /home/campusenergy/logs/db_upload.log 2>&1 # Communicator data processing jobDelete the line and save your deletion.
Campus-Energy/communicator-project
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|