chmod issue in bash script

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a script to format a drive, set permissions (777), copy a file, change permissions (555) and unmount and eject the drive for cinema DCPs. Currently everything is working but I'm getting an issue with chmod. Files copy from source to target drive with proper permissions so I'm not sure what the error is. Script and output below:
Script
#! /bin/bash
#Format Drive
sudo umount /dev/sda1
sudo parted -s /dev/sda mktable msdos
sudo parted /dev/sda mkpart primary ext3 1 100%
sudo wipefs -a /dev/sda1
sudo mkfs.ext3 -I 128 -L "DCP" /dev/sda1
#Update /etc/fstab
sudo mount -a
#Mount Drive
sudo mount /dev/sda1 /media/mynamehere/
#Set Permissions
sudo chmod -R 777 /media/mynamehere/DCP
#Copy Files to Target Drive
sudo rsync -av ~/Desktop/Source_Folder/ /media/mynamehere/DCP/
#Set Permissions
sudo chmod -R 555 /media/mynamehere/DCP
#Unmount Disk
sudo umount /dev/sda1
#Eject Disk
sudo eject /dev/sda1
Output
Information: You may need to update /etc/fstab.
mke2fs 1.43.5 (04-Aug-2017)
Creating filesystem with 3931904 4k blocks and 983040 inodes
Filesystem UUID: 68e0a893-3fe8-4daf-8ba0-3d5a285903fc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
sending incremental file list
created directory /media/mynamehere/DCP
./
ASSETMAP
CPL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_a3b962d5-4e8d-46.xml
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_2707c99f-e757-44_j2c.mxf
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_fb719829-110f-4b_pcm.mxf
PKL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_608bffb5-7d2d-49.xml
VOLINDEX
sent 1,117,023,702 bytes received 185 bytes 248,227,530.44 bytes/sec
total size is 1,116,750,369 speedup is 1.00
shell-script ubuntu chmod
add a comment |Â
up vote
0
down vote
favorite
I have a script to format a drive, set permissions (777), copy a file, change permissions (555) and unmount and eject the drive for cinema DCPs. Currently everything is working but I'm getting an issue with chmod. Files copy from source to target drive with proper permissions so I'm not sure what the error is. Script and output below:
Script
#! /bin/bash
#Format Drive
sudo umount /dev/sda1
sudo parted -s /dev/sda mktable msdos
sudo parted /dev/sda mkpart primary ext3 1 100%
sudo wipefs -a /dev/sda1
sudo mkfs.ext3 -I 128 -L "DCP" /dev/sda1
#Update /etc/fstab
sudo mount -a
#Mount Drive
sudo mount /dev/sda1 /media/mynamehere/
#Set Permissions
sudo chmod -R 777 /media/mynamehere/DCP
#Copy Files to Target Drive
sudo rsync -av ~/Desktop/Source_Folder/ /media/mynamehere/DCP/
#Set Permissions
sudo chmod -R 555 /media/mynamehere/DCP
#Unmount Disk
sudo umount /dev/sda1
#Eject Disk
sudo eject /dev/sda1
Output
Information: You may need to update /etc/fstab.
mke2fs 1.43.5 (04-Aug-2017)
Creating filesystem with 3931904 4k blocks and 983040 inodes
Filesystem UUID: 68e0a893-3fe8-4daf-8ba0-3d5a285903fc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
sending incremental file list
created directory /media/mynamehere/DCP
./
ASSETMAP
CPL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_a3b962d5-4e8d-46.xml
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_2707c99f-e757-44_j2c.mxf
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_fb719829-110f-4b_pcm.mxf
PKL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_608bffb5-7d2d-49.xml
VOLINDEX
sent 1,117,023,702 bytes received 185 bytes 248,227,530.44 bytes/sec
total size is 1,116,750,369 speedup is 1.00
shell-script ubuntu chmod
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a script to format a drive, set permissions (777), copy a file, change permissions (555) and unmount and eject the drive for cinema DCPs. Currently everything is working but I'm getting an issue with chmod. Files copy from source to target drive with proper permissions so I'm not sure what the error is. Script and output below:
Script
#! /bin/bash
#Format Drive
sudo umount /dev/sda1
sudo parted -s /dev/sda mktable msdos
sudo parted /dev/sda mkpart primary ext3 1 100%
sudo wipefs -a /dev/sda1
sudo mkfs.ext3 -I 128 -L "DCP" /dev/sda1
#Update /etc/fstab
sudo mount -a
#Mount Drive
sudo mount /dev/sda1 /media/mynamehere/
#Set Permissions
sudo chmod -R 777 /media/mynamehere/DCP
#Copy Files to Target Drive
sudo rsync -av ~/Desktop/Source_Folder/ /media/mynamehere/DCP/
#Set Permissions
sudo chmod -R 555 /media/mynamehere/DCP
#Unmount Disk
sudo umount /dev/sda1
#Eject Disk
sudo eject /dev/sda1
Output
Information: You may need to update /etc/fstab.
mke2fs 1.43.5 (04-Aug-2017)
Creating filesystem with 3931904 4k blocks and 983040 inodes
Filesystem UUID: 68e0a893-3fe8-4daf-8ba0-3d5a285903fc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
sending incremental file list
created directory /media/mynamehere/DCP
./
ASSETMAP
CPL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_a3b962d5-4e8d-46.xml
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_2707c99f-e757-44_j2c.mxf
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_fb719829-110f-4b_pcm.mxf
PKL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_608bffb5-7d2d-49.xml
VOLINDEX
sent 1,117,023,702 bytes received 185 bytes 248,227,530.44 bytes/sec
total size is 1,116,750,369 speedup is 1.00
shell-script ubuntu chmod
I have a script to format a drive, set permissions (777), copy a file, change permissions (555) and unmount and eject the drive for cinema DCPs. Currently everything is working but I'm getting an issue with chmod. Files copy from source to target drive with proper permissions so I'm not sure what the error is. Script and output below:
Script
#! /bin/bash
#Format Drive
sudo umount /dev/sda1
sudo parted -s /dev/sda mktable msdos
sudo parted /dev/sda mkpart primary ext3 1 100%
sudo wipefs -a /dev/sda1
sudo mkfs.ext3 -I 128 -L "DCP" /dev/sda1
#Update /etc/fstab
sudo mount -a
#Mount Drive
sudo mount /dev/sda1 /media/mynamehere/
#Set Permissions
sudo chmod -R 777 /media/mynamehere/DCP
#Copy Files to Target Drive
sudo rsync -av ~/Desktop/Source_Folder/ /media/mynamehere/DCP/
#Set Permissions
sudo chmod -R 555 /media/mynamehere/DCP
#Unmount Disk
sudo umount /dev/sda1
#Eject Disk
sudo eject /dev/sda1
Output
Information: You may need to update /etc/fstab.
mke2fs 1.43.5 (04-Aug-2017)
Creating filesystem with 3931904 4k blocks and 983040 inodes
Filesystem UUID: 68e0a893-3fe8-4daf-8ba0-3d5a285903fc
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
sending incremental file list
created directory /media/mynamehere/DCP
./
ASSETMAP
CPL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_a3b962d5-4e8d-46.xml
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_2707c99f-e757-44_j2c.mxf
DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_fb719829-110f-4b_pcm.mxf
PKL_DCP_SHR-2D_F-185_EN_51_2K_20180125_IOP_OV_608bffb5-7d2d-49.xml
VOLINDEX
sent 1,117,023,702 bytes received 185 bytes 248,227,530.44 bytes/sec
total size is 1,116,750,369 speedup is 1.00
shell-script ubuntu chmod
edited Feb 9 at 16:46
asked Feb 9 at 16:07
tduff
32
32
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
From your output:
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
Quite simply, the directory DCP does not exist until after you create it (using rsync, in the next line).
Since you are running every command as root, running chmod 777 beforehand should not make a difference anyway (as witnessed by the fact that the rest of the script runs successfully).
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
From your output:
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
Quite simply, the directory DCP does not exist until after you create it (using rsync, in the next line).
Since you are running every command as root, running chmod 777 beforehand should not make a difference anyway (as witnessed by the fact that the rest of the script runs successfully).
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
add a comment |Â
up vote
3
down vote
accepted
From your output:
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
Quite simply, the directory DCP does not exist until after you create it (using rsync, in the next line).
Since you are running every command as root, running chmod 777 beforehand should not make a difference anyway (as witnessed by the fact that the rest of the script runs successfully).
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
From your output:
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
Quite simply, the directory DCP does not exist until after you create it (using rsync, in the next line).
Since you are running every command as root, running chmod 777 beforehand should not make a difference anyway (as witnessed by the fact that the rest of the script runs successfully).
From your output:
chmod: cannot access '/media/mynamehere/DCP': No such file or directory
Quite simply, the directory DCP does not exist until after you create it (using rsync, in the next line).
Since you are running every command as root, running chmod 777 beforehand should not make a difference anyway (as witnessed by the fact that the rest of the script runs successfully).
answered Feb 9 at 16:11
dhag
10.7k32642
10.7k32642
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
add a comment |Â
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
cheers! Thanks for the help. Will update and test.
â tduff
Feb 9 at 16:25
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f423080%2fchmod-issue-in-bash-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password