mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-09-07 02:50:39 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d49e0d3836 | |||
2008ba2771 | |||
1f6c13a595 | |||
8e9b9dcebf |
@@ -1,3 +1,3 @@
|
|||||||
## 0.25
|
## 0.27
|
||||||
|
|
||||||
- disable color in CI mode
|
- fix locking issue
|
||||||
|
@@ -19,3 +19,7 @@
|
|||||||
### Why / What?
|
### Why / What?
|
||||||
|
|
||||||
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
|
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
|
||||||
|
|
||||||
|
### Questions / Support
|
||||||
|
|
||||||
|
Check the [discussions page](https://github.com/cupcakearmy/autorestic/discussions)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.26",
|
"version": "0.27",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "tsc -w",
|
"dev": "tsc -w",
|
||||||
|
18
src/index.ts
18
src/index.ts
@@ -2,7 +2,7 @@ import colors from 'colors'
|
|||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
import { setCIMode } from 'clitastic'
|
import { setCIMode } from 'clitastic'
|
||||||
|
|
||||||
import { unlock, readLock, writeLock } from './lock'
|
import { unlock, readLock, writeLock, lock } from './lock'
|
||||||
import { Config } from './types'
|
import { Config } from './types'
|
||||||
import { init } from './config'
|
import { init } from './config'
|
||||||
import { version } from '../package.json'
|
import { version } from '../package.json'
|
||||||
@@ -118,21 +118,19 @@ async function main() {
|
|||||||
try {
|
try {
|
||||||
if (requireConfig) {
|
if (requireConfig) {
|
||||||
config = init(configFile)
|
config = init(configFile)
|
||||||
const lock = readLock()
|
const { running } = readLock()
|
||||||
if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red)
|
if (running) {
|
||||||
|
console.log('An instance of autorestic is already running for this config file'.red)
|
||||||
writeLock({
|
process.exit(1)
|
||||||
...lock,
|
}
|
||||||
running: true,
|
lock()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await queue()
|
await queue()
|
||||||
if (error) process.exit(1)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message)
|
console.error(e.message)
|
||||||
} finally {
|
} finally {
|
||||||
if (requireConfig) unlock()
|
if (requireConfig) unlock()
|
||||||
}
|
}
|
||||||
|
if (error) process.exit(1)
|
||||||
}
|
}
|
||||||
main()
|
main()
|
||||||
|
@@ -30,3 +30,10 @@ export const unlock = () => {
|
|||||||
running: false,
|
running: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const lock = () => {
|
||||||
|
writeLock({
|
||||||
|
...readLock(),
|
||||||
|
running: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user