-
Manually create the
campusenergy
user on the server (only needed for first-time setup). -
Switch to the
campusenergy
user.su campusenergy
-
Go to the
campusenergy
home directory.cd /home/campusenergy
-
Ensure there is a
.pgpass
file set up in the home directory of the user that will run the cron job. Verify that it has the correct permissions.Create the
.pgpass
file if it doesn't exist.touch ~/.pgpass
Edit the
.pgpass
file to add your database credentials.nano ~/.pgpass
Add the following line (replace with your actual credentials):
localhost:5432:uhm2023:campusenergy:your_password
Set the correct permissions.
chmod 600 ~/.pgpass
-
Clone the
communicator-project
repository.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
-
cd
into 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 job
Delete the line and save your deletion.
-
Notifications
You must be signed in to change notification settings - Fork 0
License
Campus-Energy/communicator-project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published