Skip to content

Bash script – delete old files

I have a script that uploaded a compressed file to an ftp, it is the code that I show below. This code works correctly, but I would like to adapt it so that once the file is uploaded, it deletes ftp files older than a week. Answer You can try this solution: Note: I have commented the Remove file line,

different ways to ignore a signal?

Im’ new to Linux and signal handling. the signal function prototype is below is my questions: Q1-if I want to ignore SIGINT signal, then I just need to simply code as: signal(SIGINT, SIG_IGN);, is my understanding corrct? Q2-What if I code as: since my own sigint_handler does nothing, it is pretty much …

How to redirect specific exit code into a file in bash [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I currendtly have two if statements, each with a different exit code. How can I store these …

Ruby: how to access group info from /var/db/group.db

RHEL/CentOS 8.x, Ruby 2.5.5, irb 0.9.6 We have a specialized set up that keeps user and group information in /usr/local/etc/[user|group] and a custom Makefile to add that information to /var/db/[group|passwd].db accordingly. I am trying to get the list of groups a user belongs to, in Ruby, after login. I&#821…