unix

Copy or move file into directory with parallel processing from another process

我们两清 提交于 2021-01-29 09:17:55
问题 I'm running two processes on AIX. Process one is generating several files, process two does backups from all files that are in a backup directory. Process one will copy or move the files into the backup directory. Since process two is always running in the background there is the risk of it starting a backup of a file that is still in the process of being copied or moved and therefore incomplete. How can I avoid this problem? 回答1: Process one should create files in another directory (on the

Copy or move file into directory with parallel processing from another process

若如初见. 提交于 2021-01-29 09:07:17
问题 I'm running two processes on AIX. Process one is generating several files, process two does backups from all files that are in a backup directory. Process one will copy or move the files into the backup directory. Since process two is always running in the background there is the risk of it starting a backup of a file that is still in the process of being copied or moved and therefore incomplete. How can I avoid this problem? 回答1: Process one should create files in another directory (on the

How to make a Makefile call another Makefile rules?

你离开我真会死。 提交于 2021-01-29 08:31:51
问题 As the title says: How can I call a rule in another Makefile from a Makefile? For example: I have a folder named "folder1" that has a makefile1 and another folder named "folder2" which has another makefile2 . Now I want to call a rule in makefile1 from make in "folder2". How can I do that? 来源: https://stackoverflow.com/questions/53569376/how-to-make-a-makefile-call-another-makefile-rules

How to Deploy Flask app on AWS EC2 Linux/UNIX instance

笑着哭i 提交于 2021-01-29 06:26:39
问题 How to deploy Flask app on AWS Linux/UNIX EC2 instance. With any way either 1> using Gunicorn 2> using Apache server 回答1: It's absolutely possible, but it's not the quickest process! You'll probably want to use Docker to containerize your flask app before you deploy it as well, so it boils down to these steps: Install Docker (if you don't have it) and build an image for your application and make sure you can start the container locally and the app works as intended. You'll also need to write

SSH Remote command exit code

≡放荡痞女 提交于 2021-01-29 06:06:06
问题 I know there are lots of discussions about it but i need you help with ssh remote command exit codes. I have that code: ( scan is a script which scans for viruses in the given file) for i in $FILES do RET_CODE=$(ssh $SSH_OPT $HOST "scan $i; echo $?") if [ $? -eq 0 ]; then SOME_CODE The scan works and it returns either 0 or (1 for errors) or 2 if a virus is found. But somehow my return code is always 0. Even, if i scan a virus. Here is set -x output: ++ ssh -i /home/USER/.ssh/id host 'scan

Renaming Multiple Files in Unix

眉间皱痕 提交于 2021-01-29 04:12:37
问题 I have files in below format EnvName.Fullbkp.schema_10022012_0630_Part1.expd EnvName.Fullbkp.schema_10022012_0630_Part2.expd EnvName.Fullbkp.schema_10022012_0630_Part3.expd EnvName.Fullbkp.schema_10022012_0630_Part4.expd I want to rename this with below files EnvName.Fullbkp.schema_22052013_1000_Part1.expd EnvName.Fullbkp.schema_22052013_1000_Part2.expd EnvName.Fullbkp.schema_22052013_1000_Part3.expd EnvName.Fullbkp.schema_22052013_1000_Part4.expd It means I just want to rename the 10022012

Modifying LD_LIBRARY_PATH

天大地大妈咪最大 提交于 2021-01-29 01:43:36
问题 In UNIX, i am trying to modify the LD_LIBRARY_PATH to make it include some libraries i can't add to the regular libraries of the system( I don't have root permission it's a university server...), at this point I have used many ways that I came across the web to do this but could not modify it neither can i see what is the PATH .. I have tried using: LD_LIBRARY_PATH="path-to-lib" but got :command not found. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path-to-lib but got: bad modifier in $ (/)

Modifying LD_LIBRARY_PATH

£可爱£侵袭症+ 提交于 2021-01-29 01:36:09
问题 In UNIX, i am trying to modify the LD_LIBRARY_PATH to make it include some libraries i can't add to the regular libraries of the system( I don't have root permission it's a university server...), at this point I have used many ways that I came across the web to do this but could not modify it neither can i see what is the PATH .. I have tried using: LD_LIBRARY_PATH="path-to-lib" but got :command not found. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path-to-lib but got: bad modifier in $ (/)

How do I get shell output from system()?

帅比萌擦擦* 提交于 2021-01-29 01:31:53
问题 I'm calling system() to trigger a command. I can see the output of the command in the Xcode console – but I don't know how to capture it in a string. I tried setting a string to the system() call itself, but the string was set to 0. This is the code I wrote: string node = "/usr/local/bin/node ~/Desktop/chromix-master/script/chromix.js "; string commandStr = node + "url"; char command[1024]; strcpy(command,commandStr.c_str()); system(command); Specifically, I'm trying to get the URL of the

fcntl(), F_GETFD meaning in UNIX

感情迁移 提交于 2021-01-28 19:10:14
问题 What is the meaning of F_GETFD in fcntl() function in unix ?, From what I understand it should return -1 if there is no file descriptor in the position specified.. If that's true, when would it happen ? when doing close to a file descriptor in that posstion, F_GETFD doesn't return -1 either.. This is a part of a program using F_GETFD and it will not return -1 if I close the x fd (thid fd entered 0 in the fd table since we closed 0 beforehand and did dup(x)): #include <stdio.h> #include