Skip to main content
deleted 20 characters in body
Source Link

I'm trying to execute a bash script on Linux startup, but it doesn't work. I have tried all of these commands in the crontab:

@reboot bash /home/ec2-user/mysqlamazon.sh
@reboot sh /home/ec2-user/mysqlamazon.sh
@reboot /home/ec2-user/mysqlamazon.sh
@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

I have another command on crontab which works perfectly:

@reboot pwsh file.ps1

And I have also tried this command:

@reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh

None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done

I'm trying to execute a bash script on Linux startup, but it doesn't work. I have tried all of these commands in the crontab:

@reboot bash /home/ec2-user/mysqlamazon.sh
@reboot sh /home/ec2-user/mysqlamazon.sh
@reboot /home/ec2-user/mysqlamazon.sh
@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

I have another command on crontab which works perfectly:

@reboot pwsh file.ps1

And I have also tried this command:

@reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh

None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done

I'm trying to execute a bash script on Linux startup, but it doesn't work. I have tried all of these commands in the crontab:

@reboot bash /home/user/mysqlamazon.sh
@reboot sh /home/user/mysqlamazon.sh
@reboot /home/user/mysqlamazon.sh
@reboot sleep 60 && /home/user/mysqlamazon.sh

I have another command on crontab which works perfectly:

@reboot pwsh file.ps1

And I have also tried this command:

@reboot pwsh file.ps1 && sh /home/user/mysqlamazon.sh

None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done
edited body
Source Link
Rollback to Revision 2
Source Link
Kusalananda
  • 355.9k
  • 42
  • 735
  • 1.1k

I'm trying to execute a bash script on Linux startup, but it doesn't work. The commands I'veI have tried all of these commands in the crontab are as above: @reboot bash /home/ec2-user/mysqlamazon.sh

@reboot sh /home/ec2-user/mysqlamazon.sh

@reboot /home/ec2-user/mysqlamazon.sh

@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

@reboot bash /home/ec2-user/mysqlamazon.sh
@reboot sh /home/ec2-user/mysqlamazon.sh
@reboot /home/ec2-user/mysqlamazon.sh
@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

I have another command on crontab which works perfectly: @reboot pwsh file.ps1.

@reboot pwsh file.ps1

And iI have tried also tried this command: @reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh.

@reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh

None of these work! Any help would be appreciated! None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done

I'm trying to execute a bash script on Linux startup, but it doesn't work. The commands I've tried in crontab are as above: @reboot bash /home/ec2-user/mysqlamazon.sh

@reboot sh /home/ec2-user/mysqlamazon.sh

@reboot /home/ec2-user/mysqlamazon.sh

@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

I have another command on crontab which works perfectly: @reboot pwsh file.ps1.

And i have tried also this command: @reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh.

None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done

I'm trying to execute a bash script on Linux startup, but it doesn't work. I have tried all of these commands in the crontab:

@reboot bash /home/ec2-user/mysqlamazon.sh
@reboot sh /home/ec2-user/mysqlamazon.sh
@reboot /home/ec2-user/mysqlamazon.sh
@reboot sleep 60 && /home/ec2-user/mysqlamazon.sh

I have another command on crontab which works perfectly:

@reboot pwsh file.ps1

And I have also tried this command:

@reboot pwsh file.ps1 && sh /home/ec2-user/mysqlamazon.sh

None of these work! Any help would be appreciated!

Here is the content on bash script:

while($true)
do
./transfermysql.sh > file.txt
bcp tablename in file.txt -S ***********.com,**** -U **** -P *********** -d ********* -c
:> file.txt
sleep 60
done
edited body
Source Link
Loading
deleted 4 characters in body; edited tags
Source Link
terdon
  • 252.4k
  • 69
  • 480
  • 718
Loading
Source Link
Loading