Can I delete the contents on forge/.forge - forge

On a site we have 6+gb of .sh and .output files residing in the /home/forge/.forge/
Are these just log files and can I just delete them to free up a bit of server space?

Related

Can pscp transfer to a temporary file and rename once done?

I have a very big file that has to be transferred to a remote server.
On that remote server there is a job activating each 5 min that, once sees a file name starting with the right prefix, processes it.
What happens if the job "wakes up" in the middle of transfer? In that case it would process a corrupted file.
Do pscp create a .temp file and renames it accordingly to account for that? Or do I have to handle this manually?
No pscp does not transfer the files via a temporary file.
You would have to use another SFTP client – If you use pscp as SFTP client. The pscp defaults to SFTP, but it falls back to SCP, if SFTP is not available. If you need to use SCP (what is rare), you cannot do this, as SCP protocol does not support file rename.
Either an SFTP client that at least supports file rename – Upload explicitly to a temporary file name and rename afterwards. For that you can use psftp from PuTTY package, with its put and mv commands:
open user#hostname
put C:\source\path\file.zip /destination/path/file.tmp
mv /destination/path/file.tmp /destination/path/file.zip
exit
Or use an SFTP client that can upload a files via a temporary file automatically. For example WinSCP can do that. By default it does for files over 100 KB only. If your files are smaller, you can configure it to do it for all files using the -resumesupport switch.
An example batch file that forces an upload of a file via a temporary file:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
/command ^
"open sftp://username:password#example.com/ -hostkey=""ssh-ed25519 255 ...=""" ^
"put -resumesupport=on C:\source\path\file.zip /destination/path/" ^
"exit"
The code was generated by WinSCP GUI with the "Transfer to temporary filename" options set to "All files".
See also WinSCP article Locking files while uploading / Upload to temporary file name.
(I'm the author of WinSCP)
Related question: SFTP file lock mechanism.

How to delete all files of a database in sqlite3?

How to delete all files of a database in sqlite3?
I try to delete the filename I created, but there is some strange files left.
If you sqlite3 database filename is "/xxx/test.db", you need try to delete follow four files:
"/xxx/test.db"
"/xxx/test.db-shm"
"/xxx/test.db-wal"
"/xxx/test.db-journal"
These four files may exist, may not exist , so you should ignore the error of "file not exist" during the unlinkat/unlink syscall.
From https://www.sqlite.org/tempfiles.html:
SQLite currently uses nine distinct types of temporary files:
Rollback journals
Master journals
Write-ahead Log (WAL) files
Shared-memory files
Statement journals
TEMP databases
Materializations of views and subqueries
Transient indices
Transient databases used by VACUUM
The following are always written in the same directory as the database file:
rollback journal (with the same name as the database file but with the 8 characters "-journal" appended)
WAL ("-wal" appended)
shared-memory file ("-shm" appended)
Master Journal File (randomized suffix)
Other temporary files can be located in the same directory, depending on a variety of factors.
See the above link for further details.
By request
If DBNAME is a pathname of the SQLite database, you might like to consider these options for removing all the related files in the directory in which the database file lives:
rm -i ${DBNAME} ${DBNAME}-*
or:
rm -i ${DBNAME}*
or if you're quite sure, either of the above but without -i

Oracle UTL_FILE.fremove (or frename) permission denied

We have a oracle 12.1.0.2 installation on Linux, we have a procedure that read files from a folder, process data and writes file to another folder, and we have all permission required on the folder, so it works up to this point.
The problem arise when we try to remove the source file from the starting folder, because the database user has all the the rights on the folder but not on the specific file! Users and suppliers can upload file in this folder via ftp and we couldn't find way to replicate folder permission, I attach a couple of screenshots, please help.
Oracle error is ORA-29283: Invalid file operation
Folder Rights
File Rights
During creation of the files, the permission -rwxr-xr-x might be granted by issuing :
$ chmod 755 test_ftp.xlsx or $ chmod a+x test_ftp.xlsx for related file to be able to be deleted.

NGINX + PHP-FPM tmp dir

I need to know where the uploaded files are sent when a user upload a file like an image through php. The files are written direct to the destination directory in scripts or they uploaded to an tmp directory? In this case, would be nice if tmp directory were mounted with flags noexec and nosuid. With FPM PHP and NGINX, this is necessary? when I list the content of the directory /tmp while I upload an file, the directory is showing empty.
PS: the script is running as user that owner directory. I change the var tmp_upload_dir and when a file is uploaded, the directory still empty.

Rsync without creating hidden file in destination

rsync creates a temporary hidden file during a transfer, but the file is renamed when the transfer is complete. I would like to rsync files without creating a hidden file.
alvits is correct, --inplace will fix this for you. I found this when I had issues syncing music to my phone (mounted on ubuntu with jmtpfs). I would get a string of errors renaming the temporary files to replace existing files.

Resources