mbucc / shmig

Database migration tool written in BASH.
BSD 3-Clause "New" or "Revised" License
458 stars 49 forks source link

Permission denied when attempting to delete /tmp/shmig-migration-error.xxx.tmp #65

Open hi-bella opened 3 years ago

hi-bella commented 3 years ago

Hi all, I'm having an issue when try to shmig up/down in my server and got an error message like this

/usr/local/bin/shmig: line 607: /tmp/shmig-migration-error.10521.tmp: Permission denied
error

what is the proper way to delete this temporary file ? Thank you.

mbucc commented 3 years ago

Hi,

Can you tell me

  1. How you ran shmig?
  2. The output of: $ ls -l /tmp/shmig-migration-error.10521.tmp
hi-bella commented 3 years ago
  1. I ran shmig with command shmig up for create the table and shmig down for drop table. The shmig are in /usr/local/bin. I ran the shmig command with another user in the server (not root)
  2. This is the output:
    
    -rw-r--r-- 1 root root 0 Aug  4 09:34 /tmp/shmig-migration-error.10521.tmp
mbucc commented 3 years ago

Hi,

Somehow, you ran shmig as root. So you need to become the root user to remove that file.

ivanruslimcdohl commented 3 years ago

I've encountered the same issue. So i'm trying to run shmig in jenkins, in my case the user is jenkins and it sometimes failed in the process of shmig up or shmig down

so is there any way to be able to do it without being root ? thankyou

mbucc commented 3 years ago

yes, shmig runs fine as non-root user.