Skip to content

Tag: linux

Is rename() without fsync() safe?

Is it safe to call rename(tmppath, path) without calling fsync(tmppath_fd) first? I want the path to always point to a complete file. I care mainly about Ext4. Is the rename() promised to be safe in all future Linux kernel versions? A usage example in Python: Answer No. Look at libeatmydata, and this presenta…

Uploading all my files to GitHub

I created a new repo on github called GHide. The repo is completely empty. I read the instructions on github for a hello-world repo. But I can’t find out how I can upload my existing GHide files from my computer to the GitHub repo. How is that to be done. I am using Linux so command-line git commands wi…

Check if mysql database exists, perform action based on result

Is it possible from within a bash script to check if a mysql database exists. Depending on the result then perform another action or terminate the script? Answer Example script (Thanks to Bill Karwin for the –user and –password comment!): These are what the commands look like when run at a prompt:…

Omitting the first line from any Linux command output

I have a requirement where i’d like to omit the 1st line from the output of ls -latr “some path” Since I need to remove total 136 from the below output So I wrote ls -latr /home/kjatin1/DT_901_linux//autoInclude/system | tail -q which excluded the 1st line, but when the folder is empty it do…

SVN Update Crontab Linux

I am trying to figure out how to run a SSH command via cron for linux. The command I want to run is: Something like: Anyone know what I would need to do with the cron line? EDIT: I don’t need it to be SSH, just need to run svn update on the same server as cron to the working

basename with spaces in a bash script?

I’m working on a bash script to create a new folder in /tmp/ using the name of a file, and then copy the file inside that folder. Behavior: When I type in mymove “/home/me/downloads/my new file.zip” it shows this: I have lots of quotes around everything, so I don’t understand why this …