I wanthave created a .ps1 file on /var/spool/ which is supposed to transfercopy new files from my server in Asterisk (FreePBX)an asterisk directory and transfer them to an Azure Storage using PowerShellstorage container. I added the commandThis file is supposed to /etc/rc.localget each last recording file and transfer it to the Azure's container. When I executerun the command manually on root, it works:. This is an output of a recording file successfully uploaded on Azure's container.
Name BlobType Length ContentType L
a
s
t
M
o
d
i
f
i
e
d
---- -------- ------ ----------- -
out-067…9249.0.wav BlockBlob 44 application/octet-stream 2
uploaded!
To get every new recordings it has to be run endlessly ( check for new files every one minute).
In case of any system reboot or power outage I want this file (ps1) to start running again after OS boot.
To do this I tried adding the command pwsh /var/spool/transferrecordings.ps1 on /etc/rc.local to make it work in case of a system reboot. I edited this directory with vi /etc/rc.local as below:
But nothing seems to happen on server boot.
ThisThis is the script I'm using in the directory /etc/rc.local .
The script I have addedBut nothing seems to happen on .ps1 file is a cycle do/done while($true), which means it must work continuously when the server is on.
I also have checked the status system to see if there's a problem with root, but output says: activeboot.
I tried editing crontab with sudo chmod systemctl enablecrontab rc-locale by adding command: @reboot /var/spool/transferrecordings.ps1. Nothing again.
I'm using Sangoma Linux (CentOS 3.10.0).