Skip to main content
added 95 characters in body
Source Link
admiri
  • 101
  • 3

To get every new recordings it has to be run endlessly ( check for new files every one minute). To do this I have used a cycle do/while($true), with a commandsleep 60 inside it. In case of any system reboot or power outage I want this file (ps1) to start running again after OS boot.

I tried editing crontab with crontab -e by adding command:    @reboot pwsh /var/spool/transferrecordings.ps1. Nothing again.

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.

I tried editing crontab with crontab -e by adding command:  @reboot /var/spool/transferrecordings.ps1. Nothing again.

To get every new recordings it has to be run endlessly ( check for new files every one minute). To do this I have used a cycle do/while($true), with a commandsleep 60 inside it. In case of any system reboot or power outage I want this file (ps1) to start running again after OS boot.

I tried editing crontab with crontab -e by adding command:  @reboot pwsh /var/spool/transferrecordings.ps1. Nothing again.

improved formatting
Source Link
admiri
  • 101
  • 3

How to run a PowerShell file during boot as root on Asterisk?

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).

How to run a PowerShell file during boot as root on Asterisk

I want to transfer files from my server in Asterisk (FreePBX) to Azure Storage using PowerShell. I added the command to /etc/rc.local. When I execute the command manually on root, it works:

pwsh /var/spool/transferrecordings.ps1

But nothing seems to happen on server boot. This is the script I'm using in the directory /etc/rc.local .

The script I have added 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: active.

sudo chmod systemctl enable rc-local

How to run a PowerShell file during boot as root on Asterisk?

I have created a .ps1 file on /var/spool/ which is supposed to copy new files from an asterisk directory and transfer them to an Azure storage container. This file is supposed to get each last recording file and transfer it to the Azure's container. When I run 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:

This is the script I'm using in the directory /etc/rc.local .

But nothing seems to happen on server boot.

I tried editing crontab with crontab -e by adding command: @reboot /var/spool/transferrecordings.ps1. Nothing again.

I'm using Sangoma Linux (CentOS 3.10.0).

Source Link
admiri
  • 101
  • 3

How to run a PowerShell file during boot as root on Asterisk

On Asterisk boot/reboot I want a PowerShell file to be executed.

I want to transfer files from my server in Asterisk (FreePBX) to Azure Storage using PowerShell. I added the command to /etc/rc.local. When I execute the command manually on root, it works:

pwsh /var/spool/transferrecordings.ps1

But nothing seems to happen on server boot. This is the script I'm using in the directory /etc/rc.local .


# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

pwsh /var/spool/transferrecordings.ps1
exit 0

The script I have added 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: active.

sudo chmod systemctl enable rc-local

Any suggestions please?